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 14c9f0a
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions pkg/traverse/golang.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package traverse

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

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 14c9f0a

Please sign in to comment.