Adjust Travis CI script (#60)

Rather than running gofmt for every version, leading to version skew
when what gofmt considers "correct" differs between versions,
only use one specific version of gofmt.

Also, remove the "-s" flag from gofmt because it is not backwards compatible.
Suppose Go1.11 allowed for elliding types on struct literals and the "-s"
flag strips them, then this would be problematic because it would not compile
on Go1.10 and earlier.

Also, fix the code so that vet is happy. I am not sure why these checks
were not triggered before. There seems to be a bug in the caching of
$GOPATH/pkg files. This may be fixed in Go1.10 by the new caching logic.
Running "go install" before running go vet fixes the issue.

In other words, the only check we perform for differing versions
is that the tests pass (and implicitly that it builds).
3 files changed
tree: a92c01631f81d8af91f7c88dfba87f390087b449
  1. .travis.yml
  2. CONTRIBUTING.md
  3. LICENSE
  4. README.md
  5. cmp/
README.md

Package for equality of Go values

GoDoc 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 GoDoc 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