pkg/proc,service/test: refactor to strings.ReplaceAll (#3269)

Use strings.ReplaceAll instead of strings.Replace with -1 as the last argument.
This commit is contained in:
Oleksandr Redko
2023-02-14 19:36:24 +02:00
committed by GitHub
parent bc5c0d4a9b
commit f6e6eadd22
6 changed files with 11 additions and 11 deletions

View File

@ -4795,7 +4795,7 @@ func TestListPackagesBuildInfo(t *testing.T) {
if fidx < 0 {
continue
}
if !strings.HasSuffix(strings.Replace(pkg.DirectoryPath, "\\", "/", -1), pkg.ImportPath[fidx:]) {
if !strings.HasSuffix(strings.ReplaceAll(pkg.DirectoryPath, "\\", "/"), pkg.ImportPath[fidx:]) {
t.Errorf("unexpected suffix: %q %q", pkg.ImportPath, pkg.DirectoryPath)
}
}
@ -5872,7 +5872,7 @@ func TestNilPtrDerefInBreakInstr(t *testing.T) {
withTestProcess("asmnilptr/", t, func(p *proc.Target, fixture protest.Fixture) {
f := filepath.Join(fixture.BuildDir, asmfile)
f = strings.Replace(f, "\\", "/", -1)
f = strings.ReplaceAll(f, "\\", "/")
setFileBreakpoint(p, t, f, 5)
t.Logf("first continue")
assertNoError(p.Continue(), t, "Continue()")