mirror of
https://github.com/golang/go
synced 2024-11-17 23:44:48 -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"):]
|
majorStr := (*goVersionStr)[len("go"):]
|
||||||
minorStr := "0"
|
minorStr := "0"
|
||||||
if i := strings.Index(majorStr, "."); i >= 0 {
|
if before, after, found := strings.Cut(majorStr, "."); found {
|
||||||
majorStr, minorStr = majorStr[:i], majorStr[i+len("."):]
|
majorStr, minorStr = before, after
|
||||||
}
|
}
|
||||||
major, err1 := strconv.Atoi(majorStr)
|
major, err1 := strconv.Atoi(majorStr)
|
||||||
minor, err2 := strconv.Atoi(minorStr)
|
minor, err2 := strconv.Atoi(minorStr)
|
||||||
|
Loading…
Reference in New Issue
Block a user