From 5715d735590cf545f03b34e58ade83b919e53fba Mon Sep 17 00:00:00 2001 From: Marcel Meyer Date: Mon, 14 Apr 2025 15:34:30 +0000 Subject: all: use strings.ReplaceAll where applicable ``` find . \ -not -path './.git/*' \ -not -path './test/*' \ -not -path './src/cmd/vendor/*' \ -not -wholename './src/strings/example_test.go' \ -type f \ -exec \ sed -i -E 's/strings\.Replace\((.+), -1\)/strings\.ReplaceAll\(\1\)/g' {} \; ``` Change-Id: I59e2e91b3654c41a32f17dd91ec56f250198f0d6 GitHub-Last-Rev: 0868b1eccc945ca62a5ed0e56a4054994d4bd659 GitHub-Pull-Request: golang/go#73370 Reviewed-on: https://go-review.googlesource.com/c/go/+/665395 Reviewed-by: Keith Randall Reviewed-by: Keith Randall LUCI-TryBot-Result: Go LUCI Auto-Submit: Keith Randall Reviewed-by: Robert Griesemer --- src/debug/dwarf/line.go | 2 +- src/debug/dwarf/line_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/debug') diff --git a/src/debug/dwarf/line.go b/src/debug/dwarf/line.go index 3a02c8e307..3811416b92 100644 --- a/src/debug/dwarf/line.go +++ b/src/debug/dwarf/line.go @@ -837,7 +837,7 @@ func splitDrive(path string) (drive, rest string) { } if len(path) > 3 && (path[0] == '\\' || path[0] == '/') && (path[1] == '\\' || path[1] == '/') { // Normalize the path so we can search for just \ below. - npath := strings.Replace(path, "/", `\`, -1) + npath := strings.ReplaceAll(path, "/", `\`) // Get the host part, which must be non-empty. slash1 := strings.IndexByte(npath[2:], '\\') + 2 if slash1 > 2 { diff --git a/src/debug/dwarf/line_test.go b/src/debug/dwarf/line_test.go index e947d99ebb..0a7ade934a 100644 --- a/src/debug/dwarf/line_test.go +++ b/src/debug/dwarf/line_test.go @@ -94,8 +94,8 @@ func TestLineGCCWindows(t *testing.T) { toWindows := func(lf *LineFile) *LineFile { lf2 := *lf - lf2.Name = strings.Replace(lf2.Name, "/home/austin/go.dev/", "C:\\workdir\\go\\", -1) - lf2.Name = strings.Replace(lf2.Name, "/", "\\", -1) + lf2.Name = strings.ReplaceAll(lf2.Name, "/home/austin/go.dev/", "C:\\workdir\\go\\") + lf2.Name = strings.ReplaceAll(lf2.Name, "/", "\\") return &lf2 } file1C := toWindows(file1C) -- cgit v1.3-5-g9baa