diff --git a/exptostd.go b/exptostd.go index c629d99..6dc61cb 100644 --- a/exptostd.go +++ b/exptostd.go @@ -311,7 +311,18 @@ func getGoVersion(pass *analysis.Pass) int { return goDevel // true } - vParts := strings.Split(strings.TrimPrefix(pkgVersion, "go"), ".") + raw := strings.TrimPrefix(pkgVersion, "go") + + // prerelease version (go1.24rc1) + idx := strings.IndexFunc(raw, func(r rune) bool { + return (r < '0' || r > '9') && r != '.' + }) + + if idx != -1 { + raw = raw[:idx] + } + + vParts := strings.Split(raw, ".") v, err := strconv.Atoi(strings.Join(vParts[:2], "")) if err != nil {