選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

README.md 1.6 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # Package for equality of Go values
  2. [![GoDoc](https://godoc.org/github.com/google/go-cmp/cmp?status.svg)][godoc]
  3. [![Build Status](https://travis-ci.org/google/go-cmp.svg?branch=master)][travis]
  4. This package is intended to be a more powerful and safer alternative to
  5. `reflect.DeepEqual` for comparing whether two values are semantically equal.
  6. The primary features of `cmp` are:
  7. * When the default behavior of equality does not suit the needs of the test,
  8. custom equality functions can override the equality operation.
  9. For example, an equality function may report floats as equal so long as they
  10. are within some tolerance of each other.
  11. * Types that have an `Equal` method may use that method to determine equality.
  12. This allows package authors to determine the equality operation for the types
  13. that they define.
  14. * If no custom equality functions are used and no `Equal` method is defined,
  15. equality is determined by recursively comparing the primitive kinds on both
  16. values, much like `reflect.DeepEqual`. Unlike `reflect.DeepEqual`, unexported
  17. fields are not compared by default; they result in panics unless suppressed
  18. by using an `Ignore` option (see `cmpopts.IgnoreUnexported`) or explicitly
  19. compared using the `AllowUnexported` option.
  20. See the [GoDoc documentation][godoc] for more information.
  21. This is not an official Google product.
  22. [godoc]: https://godoc.org/github.com/google/go-cmp/cmp
  23. [travis]: https://travis-ci.org/google/go-cmp
  24. ## Install
  25. ```
  26. go get -u github.com/google/go-cmp/cmp
  27. ```
  28. ## License
  29. BSD - See [LICENSE][license] file
  30. [license]: https://github.com/google/go-cmp/blob/master/LICENSE