google/go-cmp

Package for comparing Go values in tests

View on GitHub ↗Jump to charts ↓Open shareable report

Summary Information

Updated 28 minutes ago
Added to GitGenius on September 14th, 2026
Created on July 7th, 2017
Open Issues & Pull Requests: 66 (+0)
GitHub issues: Enabled
Number of forks: 242
Total Stargazers: 4,677 (+0)
Total Subscribers: 34 (+0)

Repository Insights (GitGenius)

Median issue/PR response: 9.5 hours
Mean response time: 20.3 days
90th percentile: 78.5 days
Tracked items: 16

Most active contributors

Sign in to see contributor activity.

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 14
New in 7 days: 0
Closed in 7 days: 0
Avg open age: 836 days
Stale 30+ days: 14
Stale 90+ days: 14

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

  • question (2)
  • enhancement (1)
  • help wanted (1)
  • reporter (1)

Most active issues this week

No issue events were indexed in the last 7 days.

Detailed Description

go-cmp is a package for comparing Go values in tests that provides a more powerful and safer alternative to reflect.DeepEqual.

The package addresses the limitations of Go's built-in reflect.DeepEqual by offering customizable equality semantics. It allows tests to define custom equality functions that override default behavior, enabling use cases like floating-point comparisons with tolerance thresholds. Types can implement an Equal method to control how instances of themselves are compared, giving package authors direct control over equality semantics. When no customization is applied, the tool recursively compares primitive kinds across values, but with a key safety difference: unexported fields are not compared by default and will cause panics unless explicitly handled through options like IgnoreUnexported or AllowUnexported.

Developers should adopt this package when testing Go code that requires flexible equality semantics beyond simple value comparison. It suits projects where default equality behavior is insufficient, particularly those involving floating-point arithmetic, custom types with special equality requirements, or cases where unexported field comparison needs explicit control. The tool is especially valuable for package authors who want to define equality semantics for their own types through the Equal method pattern.

The project maintains a stable, focused scope centered on the core equality comparison problem. Development activity shows consistent attention to the codebase with regular updates addressing edge cases and user-reported issues. The maintainers respond to community feedback and incorporate improvements that refine the tool's behavior without expanding its fundamental purpose.