diff options
author | Matthew Dempsky <mdempsky@google.com> | 2013-01-07 10:03:49 +1100 |
---|---|---|
committer | Matthew Dempsky <mdempsky@google.com> | 2013-01-07 10:03:49 +1100 |
commit | ba6f655e7ec29bdf7282591d0125c9c0e73ad235 (patch) | |
tree | 75fce0264890290e3a78c88abc1b75fb0d4f4466 /src/cmd/gofmt/long_test.go | |
parent | 425b68e68d0acfb5a994ecb247df23d873be6b75 (diff) | |
download | go-ba6f655e7ec29bdf7282591d0125c9c0e73ad235.tar.gz |
src: Use bytes.Equal instead of bytes.Compare where possible.
bytes.Equal is simpler to read and should also be faster because
of short-circuiting and assembly implementations.
Change generated automatically using:
gofmt -r 'bytes.Compare(a, b) == 0 -> bytes.Equal(a, b)'
gofmt -r 'bytes.Compare(a, b) != 0 -> !bytes.Equal(a, b)'
R=golang-dev, dave, adg, rsc
CC=golang-dev
https://codereview.appspot.com/7038051
Committer: Andrew Gerrand <adg@golang.org>
Diffstat (limited to 'src/cmd/gofmt/long_test.go')
-rw-r--r-- | src/cmd/gofmt/long_test.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/gofmt/long_test.go b/src/cmd/gofmt/long_test.go index edbce606a..862e9d987 100644 --- a/src/cmd/gofmt/long_test.go +++ b/src/cmd/gofmt/long_test.go @@ -84,7 +84,7 @@ func testFile(t *testing.T, b1, b2 *bytes.Buffer, filename string) { } // the first and 2nd result should be identical - if bytes.Compare(b1.Bytes(), b2.Bytes()) != 0 { + if !bytes.Equal(b1.Bytes(), b2.Bytes()) { t.Errorf("gofmt %s not idempotent", filename) } } |