Commit 77c34332 authored by Dave Cheney's avatar Dave Cheney

cmd/go: use filepath.SplitList when inspecting GOPATH

There exists a test case for this condition, but it only runs on unix systems, which neatly dovetails into the code always using ':' as the list separator.

R=adg, iant
CC=golang-dev
https://golang.org/cl/7057052
parent 60544b69
...@@ -128,7 +128,7 @@ func main() { ...@@ -128,7 +128,7 @@ func main() {
if gopath := os.Getenv("GOPATH"); gopath == runtime.GOROOT() { if gopath := os.Getenv("GOPATH"); gopath == runtime.GOROOT() {
fmt.Fprintf(os.Stderr, "warning: GOPATH set to GOROOT (%s) has no effect\n", gopath) fmt.Fprintf(os.Stderr, "warning: GOPATH set to GOROOT (%s) has no effect\n", gopath)
} else { } else {
for _, p := range strings.Split(gopath, ":") { for _, p := range filepath.SplitList(gopath) {
if build.IsLocalImport(p) { if build.IsLocalImport(p) {
fmt.Fprintf(os.Stderr, "go: GOPATH entry is relative; must be absolute path: %q.\nRun 'go help gopath' for usage.\n", p) fmt.Fprintf(os.Stderr, "go: GOPATH entry is relative; must be absolute path: %q.\nRun 'go help gopath' for usage.\n", p)
os.Exit(2) os.Exit(2)
......
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