Commit 428df5e3 authored by Ian Lance Taylor's avatar Ian Lance Taylor

cmd/go: don't set default GOPATH to GOROOT

It will just cause confusion later as the go tool will say
"warning: GOPATH set to GOROOT (%s) has no effect".
Better to just leave GOPATH unset and get that warning instead.

Change-Id: I78ff9e87fdf4bb0460f4f6d6ee76e1becaa3e7b0
Reviewed-on: https://go-review.googlesource.com/33105
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarRuss Cox <rsc@golang.org>
parent 66477ec8
......@@ -264,7 +264,13 @@ func defaultGOPATH() string {
env = "home"
}
if home := os.Getenv(env); home != "" {
return filepath.Join(home, "go")
def := filepath.Join(home, "go")
if def == runtime.GOROOT() {
// Don't set the default GOPATH to GOROOT,
// as that will trigger warnings from the go tool.
return ""
}
return def
}
return ""
}
......
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