MCPcopy Create free account
hub / github.com/google/go-cmp

github.com/google/go-cmp

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.6.0 ↗ · + Follow · compare 2 versions
654 symbols 1,482 edges 42 files ⚖ BSD-2-Clause 189 documented · 29% updated 2mo agov0.7.0 · 2025-02-21★ 4,67245 open issues

Browse by type

Functions 428 Types & classes 226
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Package for equality of Go values

GoDev Build Status

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.

Install

go get -u github.com/google/go-cmp/cmp

License

BSD - See LICENSE file

Extension points exported contracts — how you extend this code

browse all types & interfaces →

Core symbols most depended-on inside this repo

browse all functions →

Shape

Method 298
Struct 154
Function 130
TypeAlias 55
Interface 14
FuncType 3

Languages

Go100%

Modules by API surface

cmp/internal/teststructs/structs.go69 symbols
cmp/options.go61 symbols
cmp/path.go58 symbols
cmp/internal/teststructs/project4.go49 symbols
cmp/compare_test.go49 symbols
cmp/report_text.go38 symbols
cmp/internal/testprotos/protos.go31 symbols
cmp/compare.go26 symbols
cmp/cmpopts/equate.go26 symbols
cmp/internal/teststructs/project3.go19 symbols
cmp/internal/diff/diff.go19 symbols
cmp/cmpopts/util_test.go19 symbols

For agents

$ claude mcp add go-cmp \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page