cmd/fix: use strings.Cut

Signed-off-by: cui fliter <imcusg@gmail.com>
This commit is contained in:
cui fliter 2022-09-28 16:41:54 +08:00
parent d268504fd9
commit 336580707c

View file

@ -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)