Skip to content

Commit

Permalink
Merge pull request #1055 from carapace-sh/traverse-golang
Browse files Browse the repository at this point in the history
traverse: added golang
  • Loading branch information
rsteube authored Nov 9, 2024
2 parents e0a1359 + 096692c commit 45ee47a
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 45ee47a

Please sign in to comment.