From ba6f655e7ec29bdf7282591d0125c9c0e73ad235 Mon Sep 17 00:00:00 2001 From: Matthew Dempsky Date: Mon, 7 Jan 2013 10:03:49 +1100 Subject: 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 --- src/cmd/gofmt/long_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/cmd/gofmt/long_test.go') 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) } } -- cgit v1.2.1