cmd/go/internal/bug: use bytes.Contains

Change-Id: I982835eb0d051e48964fc4a66018514c7203dd0a
Reviewed-on: https://go-review.googlesource.com/c/go/+/436696
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
cuiweixie 2022-09-29 20:35:12 +08:00 committed by Gopher Robot
parent 679640aee8
commit 5613de9d47

View file

@ -217,7 +217,7 @@ func printGlibcVersion(w io.Writer) {
fmt.Fprintf(w, "%s: %s\n", m[1], firstLine(out)) fmt.Fprintf(w, "%s: %s\n", m[1], firstLine(out))
// print another line (the one containing version string) in case of musl libc // print another line (the one containing version string) in case of musl libc
if idx := bytes.IndexByte(out, '\n'); bytes.Index(out, []byte("musl")) != -1 && idx > -1 { if idx := bytes.IndexByte(out, '\n'); bytes.Contains(out, []byte("musl")) && idx > -1 {
fmt.Fprintf(w, "%s\n", firstLine(out[idx+1:])) fmt.Fprintf(w, "%s\n", firstLine(out[idx+1:]))
} }
} }