From 2ef330ebd9c24ff7db7bc6222f860f6421a5e320 Mon Sep 17 00:00:00 2001 From: Christopher Wedgwood Date: Sun, 13 Dec 2009 12:27:19 -0800 Subject: [PATCH] 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 --- src/clean.bash | 7 +++++++ 1 file changed, 7 insertions(+) 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 -- 2.50.0