]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/obj/x86: look for go cmd in GOBIN if present.
authorDaniel Theophanes <kardianos@gmail.com>
Fri, 10 Apr 2015 04:11:16 +0000 (21:11 -0700)
committerIan Lance Taylor <iant@golang.org>
Fri, 10 Apr 2015 04:57:00 +0000 (04:57 +0000)
If GOBIN is not empty the build moves the go executable
to a new path. When this test runs it fails to find the
go cmd in the GOROOT.

Change-Id: I100def0fbcb9691b13776f795b1d1725e36d8102
Reviewed-on: https://go-review.googlesource.com/8735
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/internal/obj/x86/obj6_test.go

index 93f8f3c26202d1cf5099903fd72670c14b39abe6..7b64fe962bce8189ec243bba9feacd75aa8e70f2 100644 (file)
@@ -97,8 +97,13 @@ func asmOutput(t *testing.T, s string) []byte {
        if err != nil {
                t.Fatal(err)
        }
+       gofolder := filepath.Join(build.Default.GOROOT, "bin")
+       if gobin := os.Getenv("GOBIN"); len(gobin) != 0 {
+               gofolder = gobin
+       }
+
        cmd := exec.Command(
-               build.Default.GOROOT+"/bin/go", "tool", "asm", "-S", "-dynlink",
+               filepath.Join(gofolder, "go"), "tool", "asm", "-S", "-dynlink",
                "-o", filepath.Join(tmpdir, "output.6"), tmpfile.Name())
 
        var env []string