Skip to content

Commit

Permalink
traverse: added golang
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Nov 9, 2024
1 parent e0a1359 commit 096692c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions pkg/traverse/golang.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package traverse

import (
"os"
"path/filepath"
"strings"
)

// GoBinDir TODO experimental
func GoBinDir(tc Context) (dir string, err error) {
if path, ok := tc.LookupEnv("GOPATH"); ok {
dir = strings.Split(path, string(os.PathListSeparator))[0]
}

if dir == "" {
if dir, err = UserHomeDir(tc); err != nil {
return "", err
}
dir += "/go"
}

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

0 comments on commit 096692c

Please sign in to comment.