mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-25 06:49:04 +00:00
goenv: look for Go version in $GOROOT/src/internal/buildcfg/zbootstrap.go
The old path, $GOROOT/runtime/internal/sys/zversion.go, no longer contains the Go version. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+2
-2
@@ -58,9 +58,9 @@ func GorootVersionString(goroot string) (string, error) {
|
|||||||
return string(data), nil
|
return string(data), nil
|
||||||
|
|
||||||
} else if data, err := ioutil.ReadFile(filepath.Join(
|
} else if data, err := ioutil.ReadFile(filepath.Join(
|
||||||
goroot, "src", "runtime", "internal", "sys", "zversion.go")); err == nil {
|
goroot, "src", "internal", "buildcfg", "zbootstrap.go")); err == nil {
|
||||||
|
|
||||||
r := regexp.MustCompile("const TheVersion = `(.*)`")
|
r := regexp.MustCompile("const version = `(.*)`")
|
||||||
matches := r.FindSubmatch(data)
|
matches := r.FindSubmatch(data)
|
||||||
if len(matches) != 2 {
|
if len(matches) != 2 {
|
||||||
return "", errors.New("Invalid go version output:\n" + string(data))
|
return "", errors.New("Invalid go version output:\n" + string(data))
|
||||||
|
|||||||
Reference in New Issue
Block a user