cmd/toolstash: use "go env GOROOT" instead of runtime.GOROOT()
The GOROOT of whatever tool build toolstash is irrelevant. We want the goroot of the "go" command we're testing. Change-Id: Ie7e11c74cb445ea694d88c743dbc239a55d47864 Reviewed-on: https://go-review.googlesource.com/43033 Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
a6971f4c11
commit
1dbffd0798
|
@ -156,6 +156,7 @@ func usage() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
goCmd = flag.String("go", "go", "path to \"go\" command")
|
||||||
norun = flag.Bool("n", false, "print but do not run commands")
|
norun = flag.Bool("n", false, "print but do not run commands")
|
||||||
verbose = flag.Bool("v", false, "print commands being run")
|
verbose = flag.Bool("v", false, "print commands being run")
|
||||||
cmp = flag.Bool("cmp", false, "compare tool object files")
|
cmp = flag.Bool("cmp", false, "compare tool object files")
|
||||||
|
@ -199,7 +200,11 @@ func main() {
|
||||||
usage()
|
usage()
|
||||||
}
|
}
|
||||||
|
|
||||||
goroot = runtime.GOROOT()
|
s, err := exec.Command(*goCmd, "env", "GOROOT").CombinedOutput()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("%s env GOROOT: %v", *goCmd, err)
|
||||||
|
}
|
||||||
|
goroot = strings.TrimSpace(string(s))
|
||||||
toolDir = filepath.Join(goroot, fmt.Sprintf("pkg/tool/%s_%s", runtime.GOOS, runtime.GOARCH))
|
toolDir = filepath.Join(goroot, fmt.Sprintf("pkg/tool/%s_%s", runtime.GOOS, runtime.GOARCH))
|
||||||
stashDir = filepath.Join(goroot, "pkg/toolstash")
|
stashDir = filepath.Join(goroot, "pkg/toolstash")
|
||||||
|
|
||||||
|
@ -248,7 +253,7 @@ func main() {
|
||||||
xcmd.Stdin = os.Stdin
|
xcmd.Stdin = os.Stdin
|
||||||
xcmd.Stdout = os.Stdout
|
xcmd.Stdout = os.Stdout
|
||||||
xcmd.Stderr = os.Stderr
|
xcmd.Stderr = os.Stderr
|
||||||
err := xcmd.Run()
|
err = xcmd.Run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue