Commit c7e91724 authored by Andrew Gerrand's avatar Andrew Gerrand

go/build: handle and warn of duplicate GOPATH entries

R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/5519050
parent 7478bb98
......@@ -157,6 +157,7 @@ func init() {
Path = []*Tree{t}
}
Loop:
for _, p := range filepath.SplitList(os.Getenv("GOPATH")) {
if p == "" {
continue
......@@ -166,6 +167,21 @@ func init() {
log.Printf("invalid GOPATH %q: %v", p, err)
continue
}
// Check for dupes.
// TODO(alexbrainman): make this correct under windows (case insensitive).
for _, t2 := range Path {
if t2.Path != t.Path {
continue
}
if t2.Goroot {
log.Printf("GOPATH is the same as GOROOT: %q", t.Path)
} else {
log.Printf("duplicate GOPATH entry: %q", t.Path)
}
continue Loop
}
Path = append(Path, t)
gcImportArgs = append(gcImportArgs, "-I", t.PkgDir())
ldImportArgs = append(ldImportArgs, "-L", t.PkgDir())
......
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