aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/link
diff options
context:
space:
mode:
authorMarcel Meyer <mm.marcelmeyer@gmail.com>2025-04-14 15:34:30 +0000
committerRobert Griesemer <gri@google.com>2025-04-16 12:26:29 -0700
commit5715d735590cf545f03b34e58ade83b919e53fba (patch)
treea400b36dabbedb30bc662433757df1bd2b807b80 /src/cmd/link
parent2cb9e7f68f90ea9119fd4172fc61630279d79d67 (diff)
downloadgo-5715d735590cf545f03b34e58ade83b919e53fba.tar.xz
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 <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Robert Griesemer <gri@google.com>
Diffstat (limited to 'src/cmd/link')
-rw-r--r--src/cmd/link/internal/ld/macho.go4
-rw-r--r--src/cmd/link/internal/ld/symtab.go2
-rw-r--r--src/cmd/link/internal/loader/loader.go2
3 files changed, 4 insertions, 4 deletions
diff --git a/src/cmd/link/internal/ld/macho.go b/src/cmd/link/internal/ld/macho.go
index 45f395358a..f55f342d6e 100644
--- a/src/cmd/link/internal/ld/macho.go
+++ b/src/cmd/link/internal/ld/macho.go
@@ -545,7 +545,7 @@ func machoadddynlib(lib string, linkmode LinkMode) {
}
func machoshbits(ctxt *Link, mseg *MachoSeg, sect *sym.Section, segname string) {
- buf := "__" + strings.Replace(sect.Name[1:], ".", "_", -1)
+ buf := "__" + strings.ReplaceAll(sect.Name[1:], ".", "_")
msect := newMachoSect(mseg, buf, segname)
@@ -1039,7 +1039,7 @@ func machosymtab(ctxt *Link) {
symstr.AddUint8('_')
// replace "·" as ".", because DTrace cannot handle it.
- name := strings.Replace(ldr.SymExtname(s), "·", ".", -1)
+ name := strings.ReplaceAll(ldr.SymExtname(s), "·", ".")
name = mangleABIName(ctxt, ldr, s, name)
symstr.Addstring(name)
diff --git a/src/cmd/link/internal/ld/symtab.go b/src/cmd/link/internal/ld/symtab.go
index b89a7802a2..759262286d 100644
--- a/src/cmd/link/internal/ld/symtab.go
+++ b/src/cmd/link/internal/ld/symtab.go
@@ -155,7 +155,7 @@ func putelfsym(ctxt *Link, x loader.Sym, typ elf.SymType, curbind elf.SymBind) {
// match exactly. Tools like DTrace will have to wait for now.
if !ctxt.DynlinkingGo() {
// Rewrite · to . for ASCII-only tools like DTrace (sigh)
- sname = strings.Replace(sname, "·", ".", -1)
+ sname = strings.ReplaceAll(sname, "·", ".")
}
if ctxt.DynlinkingGo() && bind == elf.STB_GLOBAL && curbind == elf.STB_LOCAL && ldr.SymType(x).IsText() {
diff --git a/src/cmd/link/internal/loader/loader.go b/src/cmd/link/internal/loader/loader.go
index 182379f0df..d4605ae6f7 100644
--- a/src/cmd/link/internal/loader/loader.go
+++ b/src/cmd/link/internal/loader/loader.go
@@ -2745,7 +2745,7 @@ func (reporter *ErrorReporter) Errorf(s Sym, format string, args ...interface{})
if s != 0 && reporter.ldr.SymName(s) != "" {
// Note: Replace is needed here because symbol names might have % in them,
// due to the use of LinkString for names of instantiating types.
- format = strings.Replace(reporter.ldr.SymName(s), "%", "%%", -1) + ": " + format
+ format = strings.ReplaceAll(reporter.ldr.SymName(s), "%", "%%") + ": " + format
} else {
format = fmt.Sprintf("sym %d: %s", s, format)
}