FAQ
Reviewers: rsc,

Message:
Hello rsc@golang.org (cc: golang-dev@googlegroups.com,
nicksaika@gmail.com),

I'd like you to review this change to
https://code.google.com/p/go


Description:
cmd/go: reject relative values for GOPATH

Fixes issue 4062.

Please review this at http://codereview.appspot.com/6488129/

Affected files:
M src/cmd/go/main.go


Index: src/cmd/go/main.go
===================================================================
--- a/src/cmd/go/main.go
+++ b/src/cmd/go/main.go
@@ -125,10 +125,16 @@
// Diagnose common mistake: GOPATH==GOROOT.
// This setting is equivalent to not setting GOPATH at all,
// which is not what most people want when they do it.
- if gopath := os.Getenv("GOPATH"); gopath == runtime.GOROOT() {
+ gopath := os.Getenv("GOPATH")
+ if gopath == runtime.GOROOT() {
fmt.Fprintf(os.Stderr, "warning: GOPATH set to GOROOT (%s) has no
effect\n", gopath)
}

+ if build.IsLocalImport(gopath) {
+ fmt.Fprintf(os.Stderr, "go: GOPATH cannot be relative.\nRun 'go help
gopath' for usage.\n")
+ os.Exit(2)
+ }
+
for _, cmd := range commands {
if cmd.Name() == args[0] && cmd.Run != nil {
cmd.Flag.Usage = func() { cmd.Usage() }

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedSep 14, '12 at 1:13p
activeSep 17, '12 at 8:45p
posts9
users3
websitegolang.org

3 users in discussion

Franciscossouza: 4 posts R: 4 posts Dave: 1 post

People

Translate

site design / logo © 2022 Grokbase