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/cmd/cgo/internal/testplugin/plugin_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/cmd/cgo/internal/testplugin/plugin_test.go') diff --git a/src/cmd/cgo/internal/testplugin/plugin_test.go b/src/cmd/cgo/internal/testplugin/plugin_test.go index a8d4c0ea58..d2d998e5f4 100644 --- a/src/cmd/cgo/internal/testplugin/plugin_test.go +++ b/src/cmd/cgo/internal/testplugin/plugin_test.go @@ -145,8 +145,8 @@ func goCmd(t *testing.T, op string, args ...string) string { // escape converts a string to something suitable for a shell command line. func escape(s string) string { - s = strings.Replace(s, "\\", "\\\\", -1) - s = strings.Replace(s, "'", "\\'", -1) + s = strings.ReplaceAll(s, "\\", "\\\\") + s = strings.ReplaceAll(s, "'", "\\'") // Conservative guess at characters that will force quoting if s == "" || strings.ContainsAny(s, "\\ ;#*&$~?!|[]()<>{}`") { s = "'" + s + "'" -- cgit v1.3-5-g45d5