]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: use strings.LastIndexByte to fix a TODO
authorDaniel Martí <mvdan@mvdan.cc>
Mon, 9 Jan 2023 12:46:20 +0000 (12:46 +0000)
committerDaniel Martí <mvdan@mvdan.cc>
Fri, 20 Jan 2023 09:27:21 +0000 (09:27 +0000)
Go 1.20 will require Go 1.17 to bootstrap, so we can stop worrying about
older Go bootstrap versions. https://go.dev/issues/44505 fixed most of
those TODOs, but this one was presumably forgotten about.

Change-Id: I0c19ec4eec65cd807e7db9a57c5969845d915c07
Reviewed-on: https://go-review.googlesource.com/c/go/+/461155
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/cmd/link/internal/ld/pcln.go

index 34ab86cf1289089fa2098317744c8534abbe1007..b18a2b4bd43c0e494739d2090d9fdd2fcfc754f0 100644 (file)
@@ -297,11 +297,7 @@ func (state *pclntab) generateFuncnametab(ctxt *Link, funcs []loader.Sym) map[lo
                if i < 0 {
                        return name, "", ""
                }
-               // TODO: use LastIndexByte once the bootstrap compiler is >= Go 1.5.
-               j := len(name) - 1
-               for j > i && name[j] != ']' {
-                       j--
-               }
+               j := strings.LastIndexByte(name, ']')
                if j <= i {
                        return name, "", ""
                }