diff options
author | Christopher Wedgwood <cw@f00f.org> | 2009-12-13 12:27:19 -0800 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2009-12-13 12:27:19 -0800 |
commit | 2ef330ebd9c24ff7db7bc6222f860f6421a5e320 (patch) | |
tree | 55e818c41d9723dfde8ce6951e1257b4dabd3c1a /src/clean.bash | |
parent | 31645cc0bb223b70cd96cbd82ae8534a03d04004 (diff) | |
download | go-2ef330ebd9c24ff7db7bc6222f860f6421a5e320.tar.gz go-2ef330ebd9c24ff7db7bc6222f860f6421a5e320.zip |
clean.bash: stop if $GOROOT is not set
Doing rm -rf /pkg/.. blindly isn't nice. It could have
unintended consequences.
Secondly set bash to abort on (unexpected) errors.
R=dho, rsc
CC=golang-dev
https://golang.org/cl/176056
Diffstat (limited to 'src/clean.bash')
-rwxr-xr-x | src/clean.bash | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/clean.bash b/src/clean.bash index 3687244b20..90bad1f5ff 100755 --- a/src/clean.bash +++ b/src/clean.bash @@ -3,6 +3,13 @@ # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. +set -e + +if [ -z "$GOROOT" ] ; then + echo '$GOROOT not set' + exit 1 +fi + GOBIN="${GOBIN:-$HOME/bin}" rm -rf "$GOROOT"/pkg/${GOOS}_$GOARCH |