summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDave Cheney <dave@cheney.net>2013-01-25 23:07:21 -0500
committerDave Cheney <dave@cheney.net>2013-01-25 23:07:21 -0500
commitf3e7e657afbb729491957865eddc8fc4e4d77bd6 (patch)
tree1676d092c4ea068e9e49898864c7c4572f37f8c2 /src
parenteef8fe8fb1e1f8578108fa70ffff7ccfce523aa6 (diff)
downloadgo-f3e7e657afbb729491957865eddc8fc4e4d77bd6.tar.gz
cmd/go: add missing tests
These changes to test.bash were intended to be submitted with CL 6941058, but were accidentally excluded from the original CL. R=golang-dev CC=golang-dev https://codereview.appspot.com/7232043
Diffstat (limited to 'src')
-rwxr-xr-xsrc/cmd/go/test.bash18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/cmd/go/test.bash b/src/cmd/go/test.bash
index b3e72f096..11e1f3b68 100755
--- a/src/cmd/go/test.bash
+++ b/src/cmd/go/test.bash
@@ -181,6 +181,24 @@ if [ $(GOPATH= ./testgo install 'foo/quxx' 2>&1 | egrep -c '\(\$GOPATH not set\)
ok=false
fi
+# issue 4186. go get cannot be used to download packages to $GOROOT
+# Test that without GOPATH set, go get should fail
+d=$(mktemp -d)
+mkdir -p $d/src/pkg
+if GOPATH= GOROOT=$d ./testgo get -d code.google.com/p/go.codereview/cmd/hgpatch ; then
+ echo 'go get code.google.com/p/go.codereview/cmd/hgpatch should not succeed with $GOPATH unset'
+ ok=false
+fi
+rm -rf $d
+# Test that with GOPATH=$GOROOT, go get should fail
+d=$(mktemp -d)
+mkdir -p $d/src/pkg
+if GOPATH=$d GOROOT=$d ./testgo get -d code.google.com/p/go.codereview/cmd/hgpatch ; then
+ echo 'go get code.google.com/p/go.codereview/cmd/hgpatch should not succeed with GOPATH=$GOROOT'
+ ok=false
+fi
+rm -rf $d
+
# clean up
rm -rf testdata/bin testdata/bin1
rm -f testgo