commit | cfe90e9d6ada42c159478b1fdc5562faf1ac6a60 | [log] [tgz] |
---|---|---|
author | Joe Tsai <joetsai@digital-static.net> | Thu Jul 13 14:36:16 2017 -0600 |
committer | GitHub <noreply@github.com> | Thu Jul 13 14:36:16 2017 -0600 |
tree | c1b35cb3a597e097d943f315221fc5ade887aa31 | |
parent | d82a57591e220ab549b0901ee5c6ae024077fc64 [diff] |
Remove warning about status of AllowUnexported (#5) At this point, we will not be removing the AllowUnexported option as there are several use-cases that legitimately benefit from it. Also, the current documentation does a good job of explaining what the proper use of it is. Thus, remove the warning as it is unhelpful and confusing to users. The other (unlikely) alternative I can see in the future is to make AllowUnexported the default behavior for all comparisons effectively making AllowUnexported a noop. That would be a backwards compatible change.
This package is intended to be a more powerful and safer alternative to reflect.DeepEqual
for comparing whether two values are semantically equal.
The primary features of cmp are:
When the default behavior of equality does not suit the needs of the test, custom equality functions can override the equality operation. For example, an equality function may report floats as equal so long as they are within some tolerance of each other.
Types that have an Equal
method may use that method to determine equality. This allows package authors to determine the equality operation for the types that they define.
If no custom equality functions are used and no Equal
method is defined, equality is determined by recursively comparing the primitive kinds on both values, much like reflect.DeepEqual
. Unlike reflect.DeepEqual
, unexported fields are not compared; they result in panics unless suppressed by using an Ignore
option.
This is not an official Google product.
go get -u github.com/google/go-cmp/cmp
BSD - See LICENSE file