use os.Getenv
This commit is contained in:
parent
3d2a16f4fb
commit
01916154d9
13
main.go
13
main.go
@ -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{}
|
||||
|
Loading…
Reference in New Issue
Block a user