d40cd88
diff -up go/src/cmd/dist/buildtool.go.bootstrap go/src/cmd/dist/buildtool.go
d40cd88
--- go/src/cmd/dist/buildtool.go.bootstrap	2015-11-12 06:19:58.000000000 +0100
d40cd88
+++ go/src/cmd/dist/buildtool.go	2015-11-13 09:54:58.796721027 +0100
d40cd88
@@ -106,12 +106,20 @@ func bootstrapBuildTools() {
8d165df
 	os.Setenv("GOBIN", "")
8d165df
 
8d165df
 	os.Setenv("GOOS", "")
8d165df
-	os.Setenv("GOHOSTOS", "")
8d165df
 	os.Setenv("GOARCH", "")
8d165df
+
8d165df
+	hostos := os.Getenv("GOHOSTOS")
8d165df
+	hostarch := os.Getenv("GOHOSTARCH")
8d165df
+	os.Setenv("GOHOSTOS", "")
8d165df
 	os.Setenv("GOHOSTARCH", "")
8d165df
 
8d165df
+	bingopath := pathf("%s/bin/%s_%s/go", goroot_bootstrap, hostos, hostarch)
8d165df
+	if _, err := os.Stat(bingopath); os.IsNotExist(err) {
8d165df
+		bingopath = pathf("%s/bin/go", goroot_bootstrap)
8d165df
+	}
8d165df
+
8d165df
 	// Run Go 1.4 to build binaries.
8d165df
-	run(workspace, ShowOutput|CheckExit, pathf("%s/bin/go", goroot_bootstrap), "install", "-v", "bootstrap/...")
8d165df
+	run(workspace, ShowOutput|CheckExit, bingopath, "install", "-v", "bootstrap/...")
8d165df
 
8d165df
 	// Copy binaries into tool binary directory.
8d165df
 	for _, name := range bootstrapDirs {
d40cd88
diff -up go/src/make.bash.bootstrap go/src/make.bash
d40cd88
--- go/src/make.bash.bootstrap	2015-11-13 09:54:58.797721031 +0100
d40cd88
+++ go/src/make.bash	2015-11-13 10:11:11.633552619 +0100
d40cd88
@@ -113,8 +113,15 @@ echo '##### Building Go bootstrap tool.'
8d165df
 echo cmd/dist
8d165df
 export GOROOT="$(cd .. && pwd)"
8d165df
 GOROOT_BOOTSTRAP=${GOROOT_BOOTSTRAP:-$HOME/go1.4}
8d165df
-if [ ! -x "$GOROOT_BOOTSTRAP/bin/go" ]; then
8d165df
-	echo "ERROR: Cannot find $GOROOT_BOOTSTRAP/bin/go." >&2
8d165df
+if [ -x "$GOROOT_BOOTSTRAP/bin/${GOHOSTOS}_${GOHOSTARCH}/go" ]; then
8d165df
+	rm -f cmd/dist/dist
8d165df
+	GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" "$GOROOT_BOOTSTRAP/bin/${GOHOSTOS}_${GOHOSTARCH}/go" build -o cmd/dist/dist ./cmd/dist
8d165df
+elif [ -x "$GOROOT_BOOTSTRAP/bin/go" ]; then
8d165df
+	rm -f cmd/dist/dist
8d165df
+	GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" "$GOROOT_BOOTSTRAP/bin/go" build -o cmd/dist/dist ./cmd/dist
8d165df
+else
8d165df
+	echo "ERROR: Cannot find $GOROOT_BOOTSTRAP/bin/${GOHOSTOS}_${GOHOSTARCH}/go." >&2
8d165df
+	echo "ERROR: or $GOROOT_BOOTSTRAP/bin/${GOHOSTOS}_${GOHOSTARCH}/go." >&2
8d165df
 	echo "Set \$GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4." >&2
d40cd88
 	exit 1
8d165df
 fi