aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEgon Elbre <egonelbre@gmail.com>2015-04-24 09:59:31 +0300
committerRuss Cox <rsc@golang.org>2015-06-18 17:34:26 +0000
commit4f4da07ea0f43a915489c1dec0dc47019d9ee73f (patch)
treeb2bafbbaeab4dcc373029b640aabd7d987bf67db /src
parent01187f756e26c80af83ec13b3ebdfe3bcd2d0a46 (diff)
downloadgo-4f4da07ea0f43a915489c1dec0dc47019d9ee73f.tar.xz
cmd/go: suggest running 'go help gopath' with problematic GOPATH
Suggest running 'go help gopath' when the running 'go install .' and the folder is outside of GOPATH. Added link to 'https://golang.org/doc/code.html' in gopath help for more information. Example output: % go install . go install: no install location for directory f:\x\badmessage outside GOPATH please run 'go help gopath' for more information % go help gopath ... SNIP ... See https://golang.org/doc/code.html for an example. Fixes #8457 Change-Id: I0ef6ee3c65bb12af2168eafeb757258aa3835664 Reviewed-on: https://go-review.googlesource.com/9258 Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src')
-rw-r--r--src/cmd/go/alldocs.go2
-rw-r--r--src/cmd/go/build.go3
-rw-r--r--src/cmd/go/help.go2
3 files changed, 6 insertions, 1 deletions
diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go
index d5a77a9df6..f18ed80eb7 100644
--- a/src/cmd/go/alldocs.go
+++ b/src/cmd/go/alldocs.go
@@ -868,6 +868,8 @@ Go searches each directory listed in GOPATH to find source code,
but new packages are always downloaded into the first directory
in the list.
+See https://golang.org/doc/code.html for an example.
+
Import path syntax
diff --git a/src/cmd/go/build.go b/src/cmd/go/build.go
index c0ae2dd9d4..b8f6b32536 100644
--- a/src/cmd/go/build.go
+++ b/src/cmd/go/build.go
@@ -505,7 +505,8 @@ func runInstall(cmd *Command, args []string) {
} else if p.ConflictDir != "" {
errorf("go install: no install location for %s: hidden by %s", p.Dir, p.ConflictDir)
} else {
- errorf("go install: no install location for directory %s outside GOPATH", p.Dir)
+ errorf("go install: no install location for directory %s outside GOPATH\n"+
+ "\tFor more details see: go help gopath", p.Dir)
}
}
}
diff --git a/src/cmd/go/help.go b/src/cmd/go/help.go
index 4d330f4e91..49454e5023 100644
--- a/src/cmd/go/help.go
+++ b/src/cmd/go/help.go
@@ -321,6 +321,8 @@ Here's an example directory layout:
Go searches each directory listed in GOPATH to find source code,
but new packages are always downloaded into the first directory
in the list.
+
+See https://golang.org/doc/code.html for an example.
`,
}