summaryrefslogtreecommitdiff
path: root/src/clean.bash
diff options
context:
space:
mode:
authorChristopher Wedgwood <cw@f00f.org>2009-12-13 12:27:19 -0800
committerChristopher Wedgwood <cw@f00f.org>2009-12-13 12:27:19 -0800
commit37d55d5bf58bd5c72fb8169321b77a5eaeb78a0b (patch)
tree96e4081f04465804da630606dc365732eb4614a7 /src/clean.bash
parentc928c424dfbbf9ca979b395879ffb5c3d9e2b93d (diff)
downloadgo-37d55d5bf58bd5c72fb8169321b77a5eaeb78a0b.tar.gz
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 http://codereview.appspot.com/176056 Committer: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/clean.bash')
-rwxr-xr-xsrc/clean.bash7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/clean.bash b/src/clean.bash
index 3687244b2..90bad1f5f 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