Registry / testing / google-go-cmp

google-go-cmp

JSON →
library0.7.0gogounverified

Package cmp provides a powerful and flexible comparison of Go values, useful for testing.

go get github.com/google/go-cmp
INSTALL
IMPORT
SIG · GOOGLE-GO-CMP
G
google-go-cmp
testinggov0.7.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

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

Compare two slices and print the difference.

package main import ( "fmt" "github.com/google/go-cmp/cmp" ) func main() { got := []int{1, 2, 3} want := []int{1, 2, 4} fmt.Println(cmp.Diff(got, want)) }
Debug
Known issues
gotchaUnexported fields are not compared by default; use cmp.AllowUnexported to include them.
fix
Pass cmp.AllowUnexported(MyStruct{}) to cmp.Diff or cmp.Equal.
affects: >=0.1.0
Upgrade
Version history
0.7.0latest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
google-go-cmp — go get google-go-cmp · libregistry