diff --git a/bind/bind_test.go b/bind/bind_test.go index 73a34c9..dd8ad32 100644 --- a/bind/bind_test.go +++ b/bind/bind_test.go @@ -225,8 +225,9 @@ func genObjcPackages(t *testing.T, dir string, cg *ObjcWrapper) { t.Fatal(err) } + gocmd := filepath.Join(runtime.GOROOT(), "bin", "go") cmd := exec.Command( - "go", + gocmd, "install", "-pkgdir="+filepath.Join(dir, "pkg", build.Default.GOOS+"_"+build.Default.GOARCH), "ObjC/...", @@ -266,8 +267,9 @@ func genJavaPackages(t *testing.T, dir string, cg *ClassGen) { io.Copy(buf, cg.Buf) cg.Buf = buf + gocmd := filepath.Join(runtime.GOROOT(), "bin", "go") cmd := exec.Command( - "go", + gocmd, "install", "-pkgdir="+filepath.Join(dir, "pkg", build.Default.GOOS+"_"+build.Default.GOARCH), "Java/...", diff --git a/bind/java/seq_test.go b/bind/java/seq_test.go index 5ac8c1f..fc1575c 100644 --- a/bind/java/seq_test.go +++ b/bind/java/seq_test.go @@ -37,12 +37,13 @@ func testMain(m *testing.M) int { exe = ".exe" } if runtime.GOOS != "android" { + gocmd := filepath.Join(runtime.GOROOT(), "bin", "go") gomobileBin = filepath.Join(binDir, "gomobile"+exe) gobindBin := filepath.Join(binDir, "gobind"+exe) - if out, err := exec.Command("go", "build", "-o", gomobileBin, "golang.org/x/mobile/cmd/gomobile").CombinedOutput(); err != nil { + if out, err := exec.Command(gocmd, "build", "-o", gomobileBin, "golang.org/x/mobile/cmd/gomobile").CombinedOutput(); err != nil { log.Fatalf("gomobile build failed: %v: %s", err, out) } - if out, err := exec.Command("go", "build", "-o", gobindBin, "golang.org/x/mobile/cmd/gobind").CombinedOutput(); err != nil { + if out, err := exec.Command(gocmd, "build", "-o", gobindBin, "golang.org/x/mobile/cmd/gobind").CombinedOutput(); err != nil { log.Fatalf("gobind build failed: %v: %s", err, out) } PATH := os.Getenv("PATH") diff --git a/cmd/gobind/gobind_test.go b/cmd/gobind/gobind_test.go index 7cdae3d..e3d1351 100644 --- a/cmd/gobind/gobind_test.go +++ b/cmd/gobind/gobind_test.go @@ -47,7 +47,8 @@ func testMain(m *testing.M) int { bin.Close() defer os.Remove(bin.Name()) if runtime.GOOS != "android" { - if out, err := exec.Command("go", "build", "-o", bin.Name(), "golang.org/x/mobile/cmd/gobind").CombinedOutput(); err != nil { + gocmd := filepath.Join(runtime.GOROOT(), "bin", "go") + if out, err := exec.Command(gocmd, "build", "-o", bin.Name(), "golang.org/x/mobile/cmd/gobind").CombinedOutput(); err != nil { log.Fatalf("gobind build failed: %v: %s", err, out) } gobindBin = bin.Name() @@ -109,7 +110,8 @@ type Struct struct{ t.Fatal(err) } - gopath, err := exec.Command("go", "env", "GOPATH").Output() + gocmd := filepath.Join(runtime.GOROOT(), "bin", "go") + gopath, err := exec.Command(gocmd, "env", "GOPATH").Output() if err != nil { t.Fatal(err) }