Skip to content

Commit 2bdfc57

Browse files
committed
address comments
1 parent 44e917c commit 2bdfc57

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/cmd/fix/main.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@ import (
1313
"go/parser"
1414
"go/scanner"
1515
"go/token"
16-
"internal/diff"
16+
"go/version"
1717
"io"
1818
"io/fs"
1919
"os"
2020
"path/filepath"
2121
"sort"
2222
"strconv"
2323
"strings"
24+
25+
"internal/diff"
2426
)
2527

2628
var (
@@ -73,12 +75,10 @@ func main() {
7375
report(fmt.Errorf("invalid -go=%s", *goVersionStr))
7476
os.Exit(exitCode)
7577
}
76-
version := (*goVersionStr)[len("go"):]
77-
f := strings.SplitN(version, ".", 3)
78-
majorStr := f[0]
78+
majorStr := version.Lang(*goVersionStr)
7979
minorStr := "0"
80-
if len(f) >= 1 {
81-
minorStr, _, _ = strings.Cut(f[1], "rc")
80+
if before, after, found := strings.Cut(majorStr, "."); found {
81+
majorStr, minorStr = before, after
8282
}
8383
major, err1 := strconv.Atoi(majorStr)
8484
minor, err2 := strconv.Atoi(minorStr)

0 commit comments

Comments
 (0)