mirror of
https://github.com/golang/go
synced 2024-11-17 21:34:49 -07:00
cmd/fix: use strings.Cut
Signed-off-by: cui fliter <imcusg@gmail.com>
This commit is contained in:
parent
d268504fd9
commit
336580707c
@ -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 New Issue
Block a user