aboutsummaryrefslogtreecommitdiffhomepage
path: root/goenv/version.go
diff options
context:
space:
mode:
authorsivchari <[email protected]>2024-11-15 15:39:22 +0900
committerAyke <[email protected]>2024-11-15 09:21:47 +0100
commitac9f72be617e6e72423fa7afd6bcd2aaf9377d27 (patch)
tree09ac4189da2594a7e9a0ad9a38248b2f036b6e93 /goenv/version.go
parent258dac23247209dc54a2a986da9205549600d487 (diff)
downloadtinygo-ac9f72be617e6e72423fa7afd6bcd2aaf9377d27.tar.gz
tinygo-ac9f72be617e6e72423fa7afd6bcd2aaf9377d27.zip
support to parse devl version
Signed-off-by: sivchari <[email protected]>
Diffstat (limited to 'goenv/version.go')
-rw-r--r--goenv/version.go3
1 files changed, 3 insertions, 0 deletions
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")
}