]> Cypherpunks repositories - gostls13.git/commitdiff
sudo.bash: diagnose when the go tool is not in $PATH
authorRob Pike <r@golang.org>
Thu, 15 Nov 2012 18:42:39 +0000 (10:42 -0800)
committerRob Pike <r@golang.org>
Thu, 15 Nov 2012 18:42:39 +0000 (10:42 -0800)
Fixes #4386.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/6854050

src/sudo.bash

index 40f8d1aa19248104ebc16ef0b8c9002789bbaa0b..7b7d4f1cdd5fee4d202b06f5a7a9314aa6794964 100755 (executable)
@@ -12,6 +12,12 @@ Darwin)
        exit 0
 esac
 
+# Check that the go command exists
+if ! go help >/dev/null 2>&1; then
+       echo "The go command is not in your PATH." >&2
+       exit 2
+fi
+
 eval $(go env)
 if ! [ -x $GOTOOLDIR/cov -a -x $GOTOOLDIR/prof ]; then
        echo "You don't need to run sudo.bash." >&2