From: Christopher Wedgwood Date: Sun, 13 Dec 2009 20:27:19 +0000 (-0800) Subject: clean.bash: stop if $GOROOT is not set X-Git-Tag: weekly.2009-12-22~74 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=2ef330ebd9c24ff7db7bc6222f860f6421a5e320;p=gostls13.git 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 --- 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