Skip to content

Commit 6ab8f31

Browse files
authored
Merge pull request #1056 from carapace-sh/traverse-fix-gobindir
traverse: fix GoBinDir
2 parents 45ee47a + 8404549 commit 6ab8f31

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pkg/traverse/golang.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ import (
88

99
// GoBinDir TODO experimental
1010
func GoBinDir(tc Context) (dir string, err error) {
11+
if path, ok := tc.LookupEnv("GOBIN"); ok {
12+
return filepath.ToSlash(path), nil
13+
}
14+
1115
if path, ok := tc.LookupEnv("GOPATH"); ok {
1216
dir = strings.Split(path, string(os.PathListSeparator))[0]
1317
}
@@ -16,8 +20,8 @@ func GoBinDir(tc Context) (dir string, err error) {
1620
if dir, err = UserHomeDir(tc); err != nil {
1721
return "", err
1822
}
19-
dir += "/go"
23+
dir = filepath.Join(dir, "go")
2024
}
2125

22-
return filepath.ToSlash(dir) + "/bin", nil
26+
return filepath.ToSlash(filepath.Join(dir, "bin")), nil
2327
}

0 commit comments

Comments
 (0)