For #64033
Change-Id: Iab132f86c66aa6115a349d8032e9766a14dad02e
Reviewed-on: https://go-review.googlesource.com/c/go/+/541915
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
 // [Go versions]: https://go.dev/doc/toolchain#version
 package version // import "go/version"
 
-import "internal/gover"
+import (
+       "internal/gover"
+       "strings"
+)
 
 // 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).
        if v == "" {
                return ""
        }
-       return x[:2+len(v)] // "go"+v without allocation
+       if strings.HasPrefix(x[2:], v) {
+               return x[:2+len(v)] // "go"+v without allocation
+       } else {
+               return "go" + v
+       }
 }
 
 // Compare returns -1, 0, or +1 depending on whether
 
        {"go1.2.3", "go1.2"},
        {"go1.2", "go1.2"},
        {"go1", "go1"},
+       {"go222", "go222.0"},
        {"go1.999testmod", "go1.999"},
 }