]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: suggest running 'go help gopath' with problematic GOPATH
authorEgon Elbre <egonelbre@gmail.com>
Fri, 24 Apr 2015 06:59:31 +0000 (09:59 +0300)
committerRuss Cox <rsc@golang.org>
Thu, 18 Jun 2015 17:34:26 +0000 (17:34 +0000)
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>
src/cmd/go/alldocs.go
src/cmd/go/build.go
src/cmd/go/help.go

index d5a77a9df679f53c43d6e62effa99b60c4ce863d..f18ed80eb7449a233e988f2b4c3eaa8a1073a0f8 100644 (file)
@@ -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
 
index c0ae2dd9d4502c0f120bc87b830c67b62dcc111a..b8f6b325364d628f2435b8504296df6a4dc999fe 100644 (file)
@@ -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)
                        }
                }
        }
index 4d330f4e91f7e6fda3f6dc86af69c198b0be29a4..49454e5023ca25ea068b0e09ef249cfb1d4067f0 100644 (file)
@@ -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.
        `,
 }