Skip to content

Commit

Permalink
Use bytes.ReplaceAll instead of bytes.Replace(..., -1)
Browse files Browse the repository at this point in the history
... for a trivial improvement in readability.

Should not change behavior.

Signed-off-by: Miloslav Trmač <[email protected]>
  • Loading branch information
mtrmac committed Jun 29, 2022
1 parent bc84a02 commit ba6af16
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion integration/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func fileFromFixture(c *check.C, inputPath string, edits map[string]string) stri
contents, err := os.ReadFile(inputPath)
c.Assert(err, check.IsNil)
for template, value := range edits {
updated := bytes.Replace(contents, []byte(template), []byte(value), -1)
updated := bytes.ReplaceAll(contents, []byte(template), []byte(value))
c.Assert(bytes.Equal(updated, contents), check.Equals, false, check.Commentf("Replacing %s in %#v failed", template, string(contents))) // Verify that the template has matched something and we are not silently ignoring it.
contents = updated
}
Expand Down

0 comments on commit ba6af16

Please sign in to comment.