Skip to content

Commit

Permalink
fix: Go version prerelease
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Jan 2, 2025
1 parent f385089 commit 1bbdad7
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion usetesting.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,18 @@ func (a *analyzer) isGoSupported(pass *analysis.Pass) bool {
return 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 {
Expand Down

0 comments on commit 1bbdad7

Please sign in to comment.