]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: add test for issue 3652
authorRuss Cox <rsc@golang.org>
Tue, 14 Jul 2015 19:24:26 +0000 (15:24 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 15 Jul 2015 05:06:50 +0000 (05:06 +0000)
Fixes #3652. (Well, already fixed, but tests that it stays fixed.)

Change-Id: I4e17f595ee2ad513de86ac3861e8e66b1230b3be
Reviewed-on: https://go-review.googlesource.com/12195
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/go/go_test.go

index f3ab8297290d4157a5261ba90d2a911968ed7fd7..8af8ab6cc35c1a5f162dc4e733c7bdc78825d2f3 100644 (file)
@@ -2191,3 +2191,23 @@ func TestGoGetDomainRoot(t *testing.T) {
        tg.must(os.RemoveAll(tg.path("src/go-get-issue-9357.appspot.com")))
        tg.run("get", "-u", "go-get-issue-9357.appspot.com")
 }
+
+func TestGoInstallShadowedGOPATH(t *testing.T) {
+       // golang.org/issue/3652.
+       // go get foo.io (not foo.io/subdir) was not working consistently.
+
+       testenv.MustHaveExternalNetwork(t)
+
+       tg := testgo(t)
+       defer tg.cleanup()
+       tg.makeTempdir()
+       tg.setenv("GOPATH", tg.path("gopath1")+string(filepath.ListSeparator)+tg.path("gopath2"))
+
+       tg.tempDir("gopath1/src/test")
+       tg.tempDir("gopath2/src/test")
+       tg.tempFile("gopath2/src/test/main.go", "package main\nfunc main(){}\n")
+
+       tg.cd(tg.path("gopath2/src/test"))
+       tg.runFail("install")
+       tg.grepStderr("no install location for.*gopath2.src.test: hidden by .*gopath1.src.test", "missing error")
+}