From 13159fef0423fe908aac676d7c4f377c2ae41f49 Mon Sep 17 00:00:00 2001 From: cuiweixie Date: Thu, 29 Sep 2022 21:40:39 +0800 Subject: [PATCH] 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 --- src/go/internal/gccgoimporter/ar.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 { -- 2.50.0