mirror of
https://github.com/golang/go
synced 2024-09-05 16:04:50 +00:00
cmd/fix: use strings.Cut
Change-Id: Ibee86b4c5dc9a18df9bdc65b0ec8339ee1cac7a9
GitHub-Last-Rev: 336580707c
GitHub-Pull-Request: golang/go#55911
Reviewed-on: https://go-review.googlesource.com/c/go/+/435739
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
This commit is contained in:
parent
c69d6d8b3e
commit
1d65566148
|
@ -75,8 +75,8 @@ func main() {
|
|||
}
|
||||
majorStr := (*goVersionStr)[len("go"):]
|
||||
minorStr := "0"
|
||||
if i := strings.Index(majorStr, "."); i >= 0 {
|
||||
majorStr, minorStr = majorStr[:i], majorStr[i+len("."):]
|
||||
if before, after, found := strings.Cut(majorStr, "."); found {
|
||||
majorStr, minorStr = before, after
|
||||
}
|
||||
major, err1 := strconv.Atoi(majorStr)
|
||||
minor, err2 := strconv.Atoi(minorStr)
|
||||
|
|
Loading…
Reference in a new issue