@@ -1090,7 +1090,7 @@ func testMove(t *testing.T, vcs, url, base, config string) {
1090
1090
path := tg .path (filepath .Join ("src" , config ))
1091
1091
data , err := ioutil .ReadFile (path )
1092
1092
tg .must (err )
1093
- data = bytes .Replace (data , []byte (base ), []byte (base + "XXX" ), - 1 )
1093
+ data = bytes .ReplaceAll (data , []byte (base ), []byte (base + "XXX" ))
1094
1094
tg .must (ioutil .WriteFile (path , data , 0644 ))
1095
1095
}
1096
1096
if vcs == "git" {
@@ -2360,14 +2360,14 @@ func TestShadowingLogic(t *testing.T) {
2360
2360
2361
2361
// The math in root1 is not "math" because the standard math is.
2362
2362
tg .run ("list" , "-f" , "({{.ImportPath}}) ({{.ConflictDir}})" , "./testdata/shadow/root1/src/math" )
2363
- pwdForwardSlash := strings .Replace (pwd , string (os .PathSeparator ), "/" , - 1 )
2363
+ pwdForwardSlash := strings .ReplaceAll (pwd , string (os .PathSeparator ), "/" )
2364
2364
if ! strings .HasPrefix (pwdForwardSlash , "/" ) {
2365
2365
pwdForwardSlash = "/" + pwdForwardSlash
2366
2366
}
2367
2367
// The output will have makeImportValid applies, but we only
2368
2368
// bother to deal with characters we might reasonably see.
2369
2369
for _ , r := range " :" {
2370
- pwdForwardSlash = strings .Replace (pwdForwardSlash , string (r ), "_" , - 1 )
2370
+ pwdForwardSlash = strings .ReplaceAll (pwdForwardSlash , string (r ), "_" )
2371
2371
}
2372
2372
want := "(_" + pwdForwardSlash + "/testdata/shadow/root1/src/math) (" + filepath .Join (runtime .GOROOT (), "src" , "math" ) + ")"
2373
2373
if strings .TrimSpace (tg .getStdout ()) != want {
@@ -2557,7 +2557,7 @@ func TestCoverageErrorLine(t *testing.T) {
2557
2557
2558
2558
// It's OK that stderr2 drops the character position in the error,
2559
2559
// because of the //line directive (see golang.org/issue/22662).
2560
- stderr = strings .Replace (stderr , "p.go:4:2:" , "p.go:4:" , - 1 )
2560
+ stderr = strings .ReplaceAll (stderr , "p.go:4:2:" , "p.go:4:" )
2561
2561
if stderr != stderr2 {
2562
2562
t .Logf ("test -cover changed error messages:\n before:\n %s\n \n after:\n %s" , stderr , stderr2 )
2563
2563
t .Skip ("golang.org/issue/22660" )
@@ -6171,7 +6171,7 @@ func TestCDAndGOPATHAreDifferent(t *testing.T) {
6171
6171
6172
6172
testCDAndGOPATHAreDifferent (tg , cd , gopath )
6173
6173
if runtime .GOOS == "windows" {
6174
- testCDAndGOPATHAreDifferent (tg , cd , strings .Replace (gopath , `\` , `/` , - 1 ))
6174
+ testCDAndGOPATHAreDifferent (tg , cd , strings .ReplaceAll (gopath , `\` , `/` ))
6175
6175
testCDAndGOPATHAreDifferent (tg , cd , strings .ToUpper (gopath ))
6176
6176
testCDAndGOPATHAreDifferent (tg , cd , strings .ToLower (gopath ))
6177
6177
}
0 commit comments