From a42b5274dfe76dfd0572b8e7d228879867b2e3f9 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 24 Aug 2019 01:06:14 +0900 Subject: [PATCH] cmd/ebitenmobile: Use GOROOT/bin/go instead of go Fixes #927 --- cmd/ebitenmobile/gomobile.go | 4 +++- cmd/ebitenmobile/main.go | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/ebitenmobile/gomobile.go b/cmd/ebitenmobile/gomobile.go index 68edb321f..17b1953ab 100644 --- a/cmd/ebitenmobile/gomobile.go +++ b/cmd/ebitenmobile/gomobile.go @@ -20,6 +20,7 @@ import ( "os" "os/exec" "path/filepath" + "runtime" ) const gomobileHash = "597adff16ade9d88626f8caea514bb189b8c74ee" @@ -54,7 +55,8 @@ func runGo(args ...string) error { env := []string{ "GO111MODULE=on", } - return runCommand("go", args, env) + gocmd := filepath.Join(runtime.GOROOT(), "bin", "go") + return runCommand(gocmd, args, env) } func prepareGomobileCommands() error { diff --git a/cmd/ebitenmobile/main.go b/cmd/ebitenmobile/main.go index 6fb4b618a..b90025533 100644 --- a/cmd/ebitenmobile/main.go +++ b/cmd/ebitenmobile/main.go @@ -22,6 +22,7 @@ import ( "os" "os/exec" "path/filepath" + "runtime" "strings" "text/template" @@ -45,7 +46,8 @@ func goEnv(name string) string { if val := os.Getenv(name); val != "" { return val } - val, err := exec.Command("go", "env", name).Output() + gocmd := filepath.Join(runtime.GOROOT(), "bin", "go") + val, err := exec.Command(gocmd, "env", name).Output() if err != nil { panic(err) }