diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go index 4d118f1a64..cd3e971636 100644 --- a/src/cmd/dist/build.go +++ b/src/cmd/dist/build.go @@ -1405,7 +1405,6 @@ func cmdbootstrap() { setNoOpt() goldflags = os.Getenv("GO_LDFLAGS") // we were using $BOOT_GO_LDFLAGS until now goBootstrap := pathf("%s/go_bootstrap", tooldir) - cmdGo := pathf("%s/go", gorootBin) if debug { run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full") copyfile(pathf("%s/compile1", tooldir), pathf("%s/compile", tooldir), writeExec) @@ -1488,8 +1487,8 @@ func cmdbootstrap() { goInstall(toolenv, goBootstrap, "cmd") checkNotStale(nil, goBootstrap, "std") checkNotStale(toolenv, goBootstrap, "cmd") - checkNotStale(nil, cmdGo, "std") - checkNotStale(toolenv, cmdGo, "cmd") + checkNotStale(nil, gorootBinGo, "std") + checkNotStale(toolenv, gorootBinGo, "cmd") timelog("build", "target toolchain") if vflag > 0 { @@ -1507,8 +1506,8 @@ func cmdbootstrap() { checkNotStale(toolenv, goBootstrap, append(toolchain, "runtime/internal/sys")...) checkNotStale(nil, goBootstrap, "std") checkNotStale(toolenv, goBootstrap, "cmd") - checkNotStale(nil, cmdGo, "std") - checkNotStale(toolenv, cmdGo, "cmd") + checkNotStale(nil, gorootBinGo, "std") + checkNotStale(toolenv, gorootBinGo, "cmd") if debug { run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full") checkNotStale(toolenv, goBootstrap, append(toolchain, "runtime/internal/sys")...) @@ -1542,7 +1541,7 @@ func cmdbootstrap() { os.Setenv("GOOS", gohostos) os.Setenv("GOARCH", gohostarch) os.Setenv("CC", compilerEnvLookup("CC", defaultcc, gohostos, gohostarch)) - goCmd(nil, cmdGo, "build", "-o", pathf("%s/go_%s_%s_exec%s", gorootBin, goos, goarch, exe), wrapperPath) + goCmd(nil, gorootBinGo, "build", "-o", pathf("%s/go_%s_%s_exec%s", gorootBin, goos, goarch, exe), wrapperPath) // Restore environment. // TODO(elias.naur): support environment variables in goCmd? os.Setenv("GOOS", goos) diff --git a/src/cmd/dist/test.go b/src/cmd/dist/test.go index 6eca068595..9ad2173daa 100644 --- a/src/cmd/dist/test.go +++ b/src/cmd/dist/test.go @@ -149,7 +149,7 @@ func (t *tester) run() { if t.rebuild { t.out("Building packages and commands.") // Force rebuild the whole toolchain. - goInstall(toolenv, "go", append([]string{"-a"}, toolchain...)...) + goInstall(toolenv, gorootBinGo, append([]string{"-a"}, toolchain...)...) } if !t.listMode { @@ -166,10 +166,10 @@ func (t *tester) run() { // to break if we don't automatically refresh things here. // Rebuilding is a shortened bootstrap. // See cmdbootstrap for a description of the overall process. - goInstall(toolenv, "go", toolchain...) - goInstall(toolenv, "go", toolchain...) - goInstall(toolenv, "go", "cmd") - goInstall(nil, "go", "std") + goInstall(toolenv, gorootBinGo, toolchain...) + goInstall(toolenv, gorootBinGo, toolchain...) + goInstall(toolenv, gorootBinGo, "cmd") + goInstall(nil, gorootBinGo, "std") } else { // The Go builder infrastructure should always begin running tests from a // clean, non-stale state, so there is no need to rebuild the world. @@ -179,15 +179,15 @@ func (t *tester) run() { // The cache used by dist when building is different from that used when // running dist test, so rebuild (but don't install) std and cmd to make // sure packages without install targets are cached so they are not stale. - goCmd(toolenv, "go", "build", "cmd") // make sure dependencies of targets are cached - goCmd(nil, "go", "build", "std") - checkNotStale(nil, "go", "std") + goCmd(toolenv, gorootBinGo, "build", "cmd") // make sure dependencies of targets are cached + goCmd(nil, gorootBinGo, "build", "std") + checkNotStale(nil, gorootBinGo, "std") if builder != "aix-ppc64" { // The aix-ppc64 builder for some reason does not have deterministic cgo // builds, so "cmd" is stale. Fortunately, most of the tests don't care. // TODO(#56896): remove this special case once the builder supports // determistic cgo builds. - checkNotStale(toolenv, "go", "cmd") + checkNotStale(toolenv, gorootBinGo, "cmd") } } } @@ -300,7 +300,7 @@ func (t *tester) maybeLogMetadata() error { // // TODO(prattmic): If we split dist bootstrap and dist test then this // could be simplified to directly use internal/sysinfo here. - return t.dirCmd(filepath.Join(goroot, "src/cmd/internal/metadata"), "go", []string{"run", "main.go"}).Run() + return t.dirCmd(filepath.Join(goroot, "src/cmd/internal/metadata"), gorootBinGo, []string{"run", "main.go"}).Run() } // goTest represents all options to a "go test" command. The final command will @@ -1077,9 +1077,6 @@ func flattenCmdline(cmdline []interface{}) (bin string, args []string) { } bin = list[0] - if bin == "go" { - bin = gorootBinGo - } return bin, list[1:] } @@ -1354,7 +1351,7 @@ func (t *tester) registerCgoTests() { // running in parallel with earlier tests, or if it has some other reason // for needing the earlier tests to be done. func (t *tester) runPending(nextTest *distTest) { - checkNotStale(nil, "go", "std") + checkNotStale(nil, gorootBinGo, "std") worklist := t.worklist t.worklist = nil for _, w := range worklist { @@ -1412,7 +1409,7 @@ func (t *tester) runPending(nextTest *distTest) { log.Printf("Failed: %v", w.err) t.failed = true } - checkNotStale(nil, "go", "std") + checkNotStale(nil, gorootBinGo, "std") } if t.failed && !t.keepGoing { fatalf("FAILED") @@ -1612,7 +1609,7 @@ func (t *tester) testDirTest(dt *distTest, shard, shards int) error { os.Remove(runtest.exe) }) - cmd := t.dirCmd("test", "go", "build", "-o", runtest.exe, "run.go") + cmd := t.dirCmd("test", gorootBinGo, "build", "-o", runtest.exe, "run.go") setEnv(cmd, "GOOS", gohostos) setEnv(cmd, "GOARCH", gohostarch) runtest.err = cmd.Run() diff --git a/src/cmd/dist/util.go b/src/cmd/dist/util.go index d951abd556..0083e9fb40 100644 --- a/src/cmd/dist/util.go +++ b/src/cmd/dist/util.go @@ -75,11 +75,7 @@ func runEnv(dir string, mode int, env []string, cmd ...string) string { errprintf("run: %s\n", strings.Join(cmd, " ")) } - bin := cmd[0] - if bin == "go" { - bin = gorootBinGo - } - xcmd := exec.Command(bin, cmd[1:]...) + xcmd := exec.Command(cmd[0], cmd[1:]...) if env != nil { xcmd.Env = append(os.Environ(), env...) }