summaryrefslogtreecommitdiff
path: root/vendor/golang.org/x/tools/internal/versions/versions.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/golang.org/x/tools/internal/versions/versions.go')
-rw-r--r--vendor/golang.org/x/tools/internal/versions/versions.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/vendor/golang.org/x/tools/internal/versions/versions.go b/vendor/golang.org/x/tools/internal/versions/versions.go
index e16f6c33a..8d1f7453d 100644
--- a/vendor/golang.org/x/tools/internal/versions/versions.go
+++ b/vendor/golang.org/x/tools/internal/versions/versions.go
@@ -4,6 +4,10 @@
package versions
+import (
+ "strings"
+)
+
// Note: If we use build tags to use go/versions when go >=1.22,
// we run into go.dev/issue/53737. Under some operations users would see an
// import of "go/versions" even if they would not compile the file.
@@ -45,6 +49,7 @@ func IsValid(x string) bool { return isValid(stripGo(x)) }
// stripGo converts from a "go1.21" version to a "1.21" version.
// If v does not start with "go", stripGo returns the empty string (a known invalid version).
func stripGo(v string) string {
+ v, _, _ = strings.Cut(v, "-") // strip -bigcorp suffix.
if len(v) < 2 || v[:2] != "go" {
return ""
}