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>
diff --git a/doc/progs/run.go b/doc/progs/run.go
index baef3f7..8ac75cd 100644
--- a/doc/progs/run.go
+++ b/doc/progs/run.go
@@ -105,7 +105,7 @@
// 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)
diff --git a/src/cmd/cover/cover_test.go b/src/cmd/cover/cover_test.go
index 8a56e39..1c252e6 100644
--- a/src/cmd/cover/cover_test.go
+++ b/src/cmd/cover/cover_test.go
@@ -179,7 +179,7 @@
}
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.
diff --git a/src/cmd/go/internal/version/version.go b/src/cmd/go/internal/version/version.go
index 056db7b..c2de8d3 100644
--- a/src/cmd/go/internal/version/version.go
+++ b/src/cmd/go/internal/version/version.go
@@ -138,7 +138,7 @@
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"))
}
}
diff --git a/src/runtime/mkpreempt.go b/src/runtime/mkpreempt.go
index 1fe7766..44dea22 100644
--- a/src/runtime/mkpreempt.go
+++ b/src/runtime/mkpreempt.go
@@ -131,7 +131,7 @@
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) {