mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
all: use bytes.Cut, strings.Cut
Many uses of Index/IndexByte/IndexRune/Split/SplitN can be written more clearly using the new Cut functions. Do that. Also rewrite to other functions if that's clearer. For #46336. Change-Id: I68d024716ace41a57a8bf74455c62279bde0f448 Reviewed-on: https://go-review.googlesource.com/c/go/+/351711 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
8e36ab0551
commit
4d8db00641
78 changed files with 360 additions and 581 deletions
|
|
@ -267,7 +267,7 @@ func testGdbPython(t *testing.T, cgo bool) {
|
|||
t.Fatalf("gdb exited with error: %v", err)
|
||||
}
|
||||
|
||||
firstLine := bytes.SplitN(got, []byte("\n"), 2)[0]
|
||||
firstLine, _, _ := bytes.Cut(got, []byte("\n"))
|
||||
if string(firstLine) != "Loading Go Runtime support." {
|
||||
// This can happen when using all.bash with
|
||||
// GOROOT_FINAL set, because the tests are run before
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue