Commit 4325a9ee authored by Russ Cox's avatar Russ Cox

cmd/go: reject missing source code in go get -d, same as go get -d -u

Fixes #11090.

Change-Id: I1518df7a48346b175ec80079a07225901fdd51fb
Reviewed-on: https://go-review.googlesource.com/12177Reviewed-by: default avatarRob Pike <r@golang.org>
parent f849f6b7
...@@ -96,12 +96,13 @@ func runGet(cmd *Command, args []string) { ...@@ -96,12 +96,13 @@ func runGet(cmd *Command, args []string) {
} }
args = importPaths(args) args = importPaths(args)
packagesForBuild(args)
// Phase 3. Install. // Phase 3. Install.
if *getD { if *getD {
// Download only. // Download only.
// Check delayed until now so that importPaths // Check delayed until now so that importPaths
// has a chance to print errors. // and packagesForBuild have a chance to print errors.
return return
} }
......
...@@ -1184,6 +1184,22 @@ func TestGodocInstalls(t *testing.T) { ...@@ -1184,6 +1184,22 @@ func TestGodocInstalls(t *testing.T) {
tg.wantExecutable(filepath.Join(goroot, "bin", "godoc"), "did not install godoc to $GOROOT/bin") tg.wantExecutable(filepath.Join(goroot, "bin", "godoc"), "did not install godoc to $GOROOT/bin")
} }
func TestGoGetNonPkg(t *testing.T) {
testenv.MustHaveExternalNetwork(t)
tg := testgo(t)
defer tg.cleanup()
tg.tempDir("gobin")
tg.setenv("GOPATH", tg.path("."))
tg.setenv("GOBIN", tg.path("gobin"))
tg.runFail("get", "-d", "golang.org/x/tools")
tg.grepStderr("golang.org/x/tools: no buildable Go source files", "missing error")
tg.runFail("get", "-d", "-u", "golang.org/x/tools")
tg.grepStderr("golang.org/x/tools: no buildable Go source files", "missing error")
tg.runFail("get", "-d", "golang.org/x/tools")
tg.grepStderr("golang.org/x/tools: no buildable Go source files", "missing error")
}
func TestInstalls(t *testing.T) { func TestInstalls(t *testing.T) {
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment