Skip to content

Commit d554879

Browse files
committed
fix: Go version prerelease
1 parent 6315bee commit d554879

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

exptostd.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,18 @@ func getGoVersion(pass *analysis.Pass) int {
311311
return goDevel // true
312312
}
313313

314-
vParts := strings.Split(strings.TrimPrefix(pkgVersion, "go"), ".")
314+
raw := strings.TrimPrefix(pkgVersion, "go")
315+
316+
// prerelease version (go1.24rc1)
317+
idx := strings.IndexFunc(raw, func(r rune) bool {
318+
return (r < '0' || r > '9') && r != '.'
319+
})
320+
321+
if idx != -1 {
322+
raw = raw[:idx]
323+
}
324+
325+
vParts := strings.Split(raw, ".")
315326

316327
v, err := strconv.Atoi(strings.Join(vParts[:2], ""))
317328
if err != nil {

0 commit comments

Comments
 (0)