From 238a39594b0237d0ca2be4b7ccf89c0e22a766d9 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Tue, 14 Jul 2015 15:24:26 -0400 Subject: [PATCH] cmd/go: add test for issue 3652 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 Reviewed-by: Ian Lance Taylor --- src/cmd/go/go_test.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/cmd/go/go_test.go b/src/cmd/go/go_test.go index f3ab829729..8af8ab6cc3 100644 --- a/src/cmd/go/go_test.go +++ b/src/cmd/go/go_test.go @@ -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") +} -- 2.50.0