From 1bbdad773c3d8700fba7d9e2500993177f93bcb9 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Thu, 2 Jan 2025 17:35:25 +0100 Subject: [PATCH] fix: Go version prerelease --- usetesting.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/usetesting.go b/usetesting.go index 297de2d..7258278 100644 --- a/usetesting.go +++ b/usetesting.go @@ -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 {