--- go/src/cmd/dist/buildtool.go.old 2018-03-06 20:04:38.918887861 +0100 +++ go/src/cmd/dist/buildtool.go 2018-03-06 20:06:06.887731924 +0100 @@ -169,11 +169,19 @@ defer os.Setenv("GOBIN", os.Getenv("GOBIN")) os.Setenv("GOBIN", "") + hostos := os.Getenv("GOHOSTOS") + hostarch := os.Getenv("GOHOSTARCH") + os.Setenv("GOOS", "") os.Setenv("GOHOSTOS", "") os.Setenv("GOARCH", "") os.Setenv("GOHOSTARCH", "") + bingopath := pathf("%s/bin/%s_%s/go", goroot_bootstrap, hostos, hostarch) + if _, err := os.Stat(bingopath); os.IsNotExist(err) { + bingopath = pathf("%s/bin/go", goroot_bootstrap) + } + // Run Go 1.4 to build binaries. Use -gcflags=-l to disable inlining to // workaround bugs in Go 1.4's compiler. See discussion thread: // https://groups.google.com/d/msg/golang-dev/Ss7mCKsvk8w/Gsq7VYI0AwAJ @@ -183,7 +191,7 @@ // only applies to the final cmd/go binary, but that's OK: if this is Go 1.10 // or later we don't need to disable inlining to work around bugs in the Go 1.4 compiler. cmd := []string{ - pathf("%s/bin/go", goroot_bootstrap), + bingopath, "install", "-gcflags=-l", "-tags=math_big_pure_go compiler_bootstrap",