Skip to content

Commit 96b6e78

Browse files
tklausergopherbot
authored andcommitted
cmd/compile/internal/syntax: use strings.LastIndexByte in trailingDigits
Previously, strings.LastIndexByte couldn't be used because it was only added in Go 1.5 but Go 1.4 was required for bootstrapping. In Go 1.18, the bootstrap toolchain was bumped to Go 1.17 (see #44505), thus strings.LastIndexByte can be used now. Change-Id: I01a70a59dbfc853cf03d49747a2dd62d21ba74e9 Reviewed-on: https://go-review.googlesource.com/c/go/+/522197 Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
1 parent e63be91 commit 96b6e78

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/cmd/compile/internal/syntax/parser.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,9 @@ func commentText(s string) string {
181181
}
182182

183183
func trailingDigits(text string) (uint, uint, bool) {
184-
// Want to use LastIndexByte below but it's not defined in Go1.4 and bootstrap fails.
185-
i := strings.LastIndex(text, ":") // look from right (Windows filenames may contain ':')
184+
i := strings.LastIndexByte(text, ':') // look from right (Windows filenames may contain ':')
186185
if i < 0 {
187-
return 0, 0, false // no ":"
186+
return 0, 0, false // no ':'
188187
}
189188
// i >= 0
190189
n, err := strconv.ParseUint(text[i+1:], 10, 0)

0 commit comments

Comments
 (0)