]> Cypherpunks repositories - gostls13.git/commitdiff
clean.bash: stop if $GOROOT is not set
authorChristopher Wedgwood <cw@f00f.org>
Sun, 13 Dec 2009 20:27:19 +0000 (12:27 -0800)
committerRuss Cox <rsc@golang.org>
Sun, 13 Dec 2009 20:27:19 +0000 (12:27 -0800)
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

src/clean.bash

index 3687244b20676b223f9b1b3ca3f82d09f56a26c6..90bad1f5ff8b912921321b28f4cf0ede9a410dc1 100755 (executable)
@@ -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