]> Cypherpunks repositories - gostls13.git/commitdiff
all: replace Replace(..., -1) with ReplaceAll(...)
authorPolina Osadcha <polliosa@google.com>
Thu, 18 Jun 2020 13:17:13 +0000 (16:17 +0300)
committerMartin Möhrmann <moehrmann@google.com>
Mon, 17 Aug 2020 04:07:23 +0000 (04:07 +0000)
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>
doc/progs/run.go
src/cmd/cover/cover_test.go
src/cmd/go/internal/version/version.go
src/runtime/mkpreempt.go

index baef3f79f9f31b63e1f7a11f0d703c0cbe366315..8ac75cdcff6bb8e83a9d15f794fb008982c4438f 100644 (file)
@@ -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)
index 8a56e39011321fccf0520faa350a046ecd5c7efb..1c252e6e45dcffc73b50322859658b5e5e2cea4b 100644 (file)
@@ -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.
index 056db7bf9e72512971aa99e37dd371a896539ad4..c2de8d326d90e5b6c766878d1164798753b51dbc 100644 (file)
@@ -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"))
        }
 }
 
index 1fe77663b9ca56619918cbd9d06d8ddbd406ab1f..44dea22ef300056e619590c116eb96322bf4c7f5 100644 (file)
@@ -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) {