use os.Getenv

This commit is contained in:
Stephen McQuay 2015-03-13 11:30:52 -07:00
parent 3d2a16f4fb
commit 01916154d9

13
main.go
View File

@ -16,15 +16,10 @@ func main() {
log.SetFlags(log.Ldate | log.Ltime | log.Lshortfile)
binDirs := []string{}
srcDirs := []string{}
for _, env := range os.Environ() {
if strings.HasPrefix(env, "GOPATH=") {
i := strings.Index(env, "=")
paths := filepath.SplitList(env[i+1:])
for _, path := range paths {
binDirs = append(binDirs, filepath.Join(path, "bin"))
srcDirs = append(srcDirs, filepath.Join(path, "src"))
}
}
for _, path := range filepath.SplitList(os.Getenv("GOPATH")) {
binDirs = append(binDirs, filepath.Join(path, "bin"))
srcDirs = append(srcDirs, filepath.Join(path, "src"))
}
files := []string{}