internal/build: add GoTool and document why it uses GOROOT

This commit is contained in:
Felix Lange
2017-08-07 15:50:31 +02:00
parent 46cf0a616b
commit f59a49d591
2 changed files with 15 additions and 6 deletions

View File

@ -250,10 +250,7 @@ func goTool(subcmd string, args ...string) *exec.Cmd {
}
func goToolArch(arch string, subcmd string, args ...string) *exec.Cmd {
gocmd := filepath.Join(runtime.GOROOT(), "bin", "go")
cmd := exec.Command(gocmd, subcmd)
cmd.Args = append(cmd.Args, args...)
cmd := build.GoTool(subcmd, args...)
if subcmd == "build" || subcmd == "install" || subcmd == "test" {
// Go CGO has a Windows linker error prior to 1.8 (https://github.com/golang/go/issues/8756).
// Work around issue by allowing multiple definitions for <1.8 builds.