1
0
mirror of https://github.com/moby/moby.git synced 2025-07-30 18:23:29 +03:00

all: replace strings.Replace with strings.ReplaceAll

strings.ReplaceAll(s, old, new) is a wrapper function for
strings.Replace(s, old, new, -1). But strings.ReplaceAll is more
readable and removes the hardcoded -1.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
Eng Zer Jun
2022-05-09 19:26:05 +08:00
parent bb88ff4ab4
commit 7873c27cfb
18 changed files with 35 additions and 35 deletions

View File

@ -3814,7 +3814,7 @@ func (s *DockerSuite) TestBuildSpaces(c *testing.T) {
e2 := removeLogTimestamps(result2.Error.Error())
// Ignore whitespace since that's what were verifying doesn't change stuff
if strings.Replace(e1, " ", "", -1) != strings.Replace(e2, " ", "", -1) {
if strings.ReplaceAll(e1, " ", "") != strings.ReplaceAll(e2, " ", "") {
c.Fatalf("Build 2's error wasn't the same as build 1's\n1:%s\n2:%s", result1.Error, result2.Error)
}
@ -3829,7 +3829,7 @@ func (s *DockerSuite) TestBuildSpaces(c *testing.T) {
e2 = removeLogTimestamps(result2.Error.Error())
// Ignore whitespace since that's what were verifying doesn't change stuff
if strings.Replace(e1, " ", "", -1) != strings.Replace(e2, " ", "", -1) {
if strings.ReplaceAll(e1, " ", "") != strings.ReplaceAll(e2, " ", "") {
c.Fatalf("Build 3's error wasn't the same as build 1's\n1:%s\n3:%s", result1.Error, result2.Error)
}
@ -3844,7 +3844,7 @@ func (s *DockerSuite) TestBuildSpaces(c *testing.T) {
e2 = removeLogTimestamps(result2.Error.Error())
// Ignore whitespace since that's what were verifying doesn't change stuff
if strings.Replace(e1, " ", "", -1) != strings.Replace(e2, " ", "", -1) {
if strings.ReplaceAll(e1, " ", "") != strings.ReplaceAll(e2, " ", "") {
c.Fatalf("Build 4's error wasn't the same as build 1's\n1:%s\n4:%s", result1.Error, result2.Error)
}