aboutsummaryrefslogtreecommitdiff
path: root/src/make.bash
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2017-03-10 10:04:42 -0800
committerIan Lance Taylor <iant@golang.org>2017-03-10 22:05:37 +0000
commit135ce43c8731506d541329a1dfea2c737c6dd0b1 (patch)
tree7455f48bc3df78bf1d65d1f641d1067d1249c3c2 /src/make.bash
parentda0d23e5cdb305681a55c5475ff2db3e9a254cd4 (diff)
downloadgo-135ce43c8731506d541329a1dfea2c737c6dd0b1.tar.gz
go-135ce43c8731506d541329a1dfea2c737c6dd0b1.zip
cmd/go: when expanding "cmd", skip vendored main packages
We are vendoring pprof from github.com/google/pprof, which comes with a main package. If we don't explicitly skip that main package, then `go install cmd` will install the compiled program in $GOROOT/bin. Fixes #19441. Change-Id: Ib268ffd16d4be65f7d80e4f8d9dc6e71523a94de Reviewed-on: https://go-review.googlesource.com/38007 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Raul Silvera <rsilvera@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/make.bash')
-rwxr-xr-xsrc/make.bash13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/make.bash b/src/make.bash
index 62d8b80fca..6e6f96d5c7 100755
--- a/src/make.bash
+++ b/src/make.bash
@@ -172,7 +172,20 @@ if [ "$GOHOSTARCH" != "$GOARCH" -o "$GOHOSTOS" != "$GOOS" ]; then
fi
echo "##### Building packages and commands for $GOOS/$GOARCH."
+
+old_bin_files=$(cd $GOROOT/bin && echo *)
+
CC=$CC_FOR_TARGET "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd
+
+# Check that there are no new files in $GOROOT/bin other than go and gofmt
+# and $GOOS_$GOARCH (a directory used when cross-compiling).
+(cd $GOROOT/bin && for f in *; do
+ if ! expr " $old_bin_files go gofmt ${GOOS}_${GOARCH} " : ".* $f " >/dev/null 2>/dev/null; then
+ echo 1>&2 "ERROR: unexpected new file in $GOROOT/bin: $f"
+ exit 1
+ fi
+done)
+
echo
rm -f "$GOTOOLDIR"/go_bootstrap