Skip to content

Commit

Permalink
traverse: fix GoBinDir
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Nov 9, 2024
1 parent 45ee47a commit 8404549
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/traverse/golang.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import (

// GoBinDir TODO experimental
func GoBinDir(tc Context) (dir string, err error) {
if path, ok := tc.LookupEnv("GOBIN"); ok {
return filepath.ToSlash(path), nil
}

if path, ok := tc.LookupEnv("GOPATH"); ok {
dir = strings.Split(path, string(os.PathListSeparator))[0]
}
Expand All @@ -16,8 +20,8 @@ func GoBinDir(tc Context) (dir string, err error) {
if dir, err = UserHomeDir(tc); err != nil {
return "", err
}
dir += "/go"
dir = filepath.Join(dir, "go")
}

return filepath.ToSlash(dir) + "/bin", nil
return filepath.ToSlash(filepath.Join(dir, "bin")), nil
}

0 comments on commit 8404549

Please sign in to comment.