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
This commit is contained in:
Dave Cheney 2013-01-08 10:00:21 +11:00
parent 60544b698e
commit 77c343328e
1 changed files with 1 additions and 1 deletions

View File

@ -128,7 +128,7 @@ func main() {
if gopath := os.Getenv("GOPATH"); gopath == runtime.GOROOT() {
fmt.Fprintf(os.Stderr, "warning: GOPATH set to GOROOT (%s) has no effect\n", gopath)
} else {
for _, p := range strings.Split(gopath, ":") {
for _, p := range filepath.SplitList(gopath) {
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)
os.Exit(2)