More robust GOPATH retrieval.
Keep the the program from breaking if GOPATH is not set.
diff --git a/cmd/util.go b/cmd/util.go
index 1ef986a..ba6ab17 100644
--- a/cmd/util.go
+++ b/cmd/util.go
@@ -115,11 +115,10 @@
// listed in the Gopath.
func Gopaths() []string {
p := os.Getenv("GOPATH")
+ p = strings.Trim(p, string(filepath.ListSeparator))
ps := filepath.SplitList(p)
-
- // XXX: Is this right? What is an empty path supposed to mean?
- if ps[0] == "" {
- ps[0] = "."
+ if len(ps) == 0 {
+ return []string{"."}
}
return ps
}