mirror of
https://github.com/golang/go
synced 2024-11-11 19:31:37 -07:00
all: replace Replace(..., -1) with ReplaceAll(...)
Change-Id: I8f7cff7a83a9c50bfa3331e8b40e4a6c2e1c0eee Reviewed-on: https://go-review.googlesource.com/c/go/+/245198 Run-TryBot: Martin Möhrmann <moehrmann@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
f7fc25ed5a
commit
6f99b33c18
@ -105,7 +105,7 @@ func test(tmpdir, file, want string) error {
|
||||
|
||||
// Canonicalize output.
|
||||
out = bytes.TrimRight(out, "\n")
|
||||
out = bytes.Replace(out, []byte{'\n'}, []byte{' '}, -1)
|
||||
out = bytes.ReplaceAll(out, []byte{'\n'}, []byte{' '})
|
||||
|
||||
// Check the result.
|
||||
match, err := regexp.Match(want, out)
|
||||
|
@ -179,7 +179,7 @@ func TestCover(t *testing.T) {
|
||||
}
|
||||
lines := bytes.Split(file, []byte("\n"))
|
||||
for i, line := range lines {
|
||||
lines[i] = bytes.Replace(line, []byte("LINE"), []byte(fmt.Sprint(i+1)), -1)
|
||||
lines[i] = bytes.ReplaceAll(line, []byte("LINE"), []byte(fmt.Sprint(i+1)))
|
||||
}
|
||||
|
||||
// Add a function that is not gofmt'ed. This used to cause a crash.
|
||||
|
@ -138,7 +138,7 @@ func scanFile(file string, info os.FileInfo, mustPrint bool) {
|
||||
|
||||
fmt.Printf("%s: %s\n", file, vers)
|
||||
if *versionM && mod != "" {
|
||||
fmt.Printf("\t%s\n", strings.Replace(mod[:len(mod)-1], "\n", "\n\t", -1))
|
||||
fmt.Printf("\t%s\n", strings.ReplaceAll(mod[:len(mod)-1], "\n", "\n\t"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,7 @@ func header(arch string) {
|
||||
|
||||
func p(f string, args ...interface{}) {
|
||||
fmted := fmt.Sprintf(f, args...)
|
||||
fmt.Fprintf(out, "\t%s\n", strings.Replace(fmted, "\n", "\n\t", -1))
|
||||
fmt.Fprintf(out, "\t%s\n", strings.ReplaceAll(fmted, "\n", "\n\t"))
|
||||
}
|
||||
|
||||
func label(l string) {
|
||||
|
Loading…
Reference in New Issue
Block a user