From: cuiweixie Date: Thu, 29 Sep 2022 13:40:39 +0000 (+0800) Subject: go: replace bytes.Compare with bytes.Equal X-Git-Tag: go1.20rc1~789 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=13159fef0423fe908aac676d7c4f377c2ae41f49;p=gostls13.git 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 Auto-Submit: Ian Lance Taylor Reviewed-by: Ian Lance Taylor Run-TryBot: Ian Lance Taylor Reviewed-by: Dmitri Shuralyov --- diff --git a/src/go/internal/gccgoimporter/ar.go b/src/go/internal/gccgoimporter/ar.go index 443aa26a0c..9df7934212 100644 --- a/src/go/internal/gccgoimporter/ar.go +++ b/src/go/internal/gccgoimporter/ar.go @@ -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 {