# Technical Documentation: google/go-cmp

> ℹ️ **Provenance:** In-Tree Documentation (3 Chapters) · [CodeWiki Reference](https://codewiki.google/github.com/google/go-cmp) · Recency: Active (< 180 days)

## File: README.md

# Package for equality of Go values

[][godev]
[][actions]

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][godev] for more information.

This is not an official Google product.

[godev]: https://pkg.go.dev/github.com/google/go-cmp/cmp
[actions]: https://github.com/google/go-cmp/actions

## Install

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

## License

BSD - See [LICENSE][license] file

[license]: https://github.com/google/go-cmp/blob/master/LICENSE

---

## File: CONTRIBUTING.md

# How to Contribute

We'd love to accept your patches and contributions to this project. There are
just a few small guidelines you need to follow.

## Contributor License Agreement

Contributions to this project must be accompanied by a Contributor License
Agreement. You (or your employer) retain the copyright to your contribution,
this simply gives us permission to use and redistribute your contributions as
part of the project. Head over to <https://cla.developers.google.com/> to see
your current agreements on file or to sign a new one.

You generally only need to submit a CLA once, so if you've already submitted one
(even if it was for a different project), you probably don't need to do it
again.

## Code reviews

All submissions, including submissions by project members, require review. We
use GitHub pull requests for this purpose. Consult
[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
information on using pull requests.

---

## File: .github/workflows/test.yml

on: [push, pull_request]
name: Test
permissions:
  contents: read
jobs:
  test:
    strategy:
      matrix:
        go-version: [1.21.x]
        os: [ubuntu-latest, macos-latest]
    runs-on: ${{ matrix.os }}
    steps:
    - name: Install Go
      uses: actions/setup-go@bfdd3570ce990073878bf10f6b2d79082de49492 # v2.2.0
      with:
        go-version: ${{ matrix.go-version }}
    - name: Checkout code
      uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
    - name: Test
      run: go test -v -race ./...
    - name: Format
      if: matrix.go-version == '1.21.x'
      run: diff -u <(echo -n) <(gofmt -d .)

--- METRICS ---
- Files Extracted: 3
- Estimated Token Budget: ~789 tokens
- Recency Window: Active (< 180 days)
- Canonical Reference: https://codewiki.google/github.com/google/go-cmp
