go: replace bytes.Compare with bytes.Equal

Change-Id: I268033bfcda34b76ef1d3a3446d6d1d875fc33ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/436716
Run-TryBot: xie cui <523516579@qq.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
This commit is contained in:
cuiweixie 2022-09-29 21:40:39 +08:00 committed by Gopher Robot
parent 7aa4905bb4
commit 13159fef04

View file

@ -82,7 +82,7 @@ func standardArExportData(archive io.ReadSeeker) (io.ReadSeeker, error) {
}
off += arHdrSize
if bytes.Compare(hdrBuf[arFmagOff:arFmagOff+arFmagSize], []byte(arfmag)) != 0 {
if !bytes.Equal(hdrBuf[arFmagOff:arFmagOff+arFmagSize], []byte(arfmag)) {
return nil, fmt.Errorf("archive header format header (%q)", hdrBuf[:])
}
@ -92,7 +92,7 @@ func standardArExportData(archive io.ReadSeeker) (io.ReadSeeker, error) {
}
fn := hdrBuf[arNameOff : arNameOff+arNameSize]
if fn[0] == '/' && (fn[1] == ' ' || fn[1] == '/' || bytes.Compare(fn[:8], []byte("/SYM64/ ")) == 0) {
if fn[0] == '/' && (fn[1] == ' ' || fn[1] == '/' || string(fn[:8]) == "/SYM64/ ") {
// Archive symbol table or extended name table,
// which we don't care about.
} else {