commit | 522f2f49b4cac3501f615bede8ee1bd27a289e98 | [log] [tgz] |
---|---|---|
author | Linux Build Service Account <lnxbuild@localhost> | Sun Jan 15 11:58:25 2023 -0800 |
committer | Linux Build Service Account <lnxbuild@localhost> | Sun Jan 15 11:58:25 2023 -0800 |
tree | 740cf616383317a58c11695d1c5cf7c47f4c6e79 | |
parent | 8813036667c680992eade0153cbe0e6ec28cb20c [diff] | |
parent | 6af3ae32598d883c8814721048c51b96bbc3fcb1 [diff] |
Merge 6af3ae32598d883c8814721048c51b96bbc3fcb1 on remote branch Change-Id: I3dbcad9513d5642f48ac27b4e9b3d6ca69fe7cb6
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 by default; they result in panics unless suppressed by using an Ignore
option (see cmpopts.IgnoreUnexported
) or explicitly compared using the AllowUnexported
option.
See the documentation for more information.
This is not an official Google product.
go get -u github.com/google/go-cmp/cmp
BSD - See LICENSE file