cmd/link: use strings.LastIndexByte to fix a TODO

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>
This commit is contained in:
Daniel Martí 2023-01-09 12:46:20 +00:00
parent 8354f6b5bb
commit 1bef0707a5
1 changed files with 1 additions and 5 deletions

View 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, "", ""
}