diff --git a/goenv/version.go b/goenv/version.go index 158c3caf2..4815d434a 100644 --- a/goenv/version.go +++ b/goenv/version.go @@ -50,6 +50,9 @@ func GetGorootVersion() (major, minor int, err error) { // major, minor, and patch version: 1, 3, and 2 in this example. // If there is an error, (0, 0, 0) and an error will be returned. func Parse(version string) (major, minor, patch int, err error) { + if strings.HasPrefix(version, "devel ") { + version = strings.Split(strings.TrimPrefix(version, "devel "), version)[0] + } if version == "" || version[:2] != "go" { return 0, 0, 0, errors.New("could not parse Go version: version does not start with 'go' prefix") } diff --git a/goenv/version_test.go b/goenv/version_test.go index 1744d2b22..cb408a2ea 100644 --- a/goenv/version_test.go +++ b/goenv/version_test.go @@ -21,6 +21,7 @@ func TestParse(t *testing.T) { {"go1.23.5-rc6", 1, 23, 5, false}, {"go2.0", 2, 0, 0, false}, {"go2.0.15", 2, 0, 15, false}, + {"devel go1.24-f99f5da18f Thu Nov 14 22:29:26 2024 +0000 darwin/arm64", 1, 24, 0, false}, } for _, tt := range tests { t.Run(tt.v, func(t *testing.T) {