Commit 547784a
fix(exec): deduplicate GOPATH before prepending version-specific path (#553)
When goenv exec is called from inside a shell that already has
GOPATH set by goenv (e.g. a tool like gup that shells out to
`go env GOPATH` through the goenv shim), exec.go was blindly
prepending the version-specific path without filtering existing
goenv-managed entries. This produced a doubled GOPATH such as:
/Users/user/go/1.26.3:/Users/user/go/1.26.3
Which caused gup to construct the literal path
`/Users/user/go/1.26.3:/Users/user/go/1.26.3/bin` and fail
with "no such file or directory" when scanning for installed binaries.
Apply the same deduplication guard already present in sh-rehash.go:
filter out any $HOME/go/{version} entries from the existing GOPATH
before appending, so re-entrant exec calls stay idempotent.
Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>1 parent 1330a4b commit 547784a
1 file changed
Lines changed: 13 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
128 | 131 | | |
129 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
130 | 142 | | |
131 | 143 | | |
132 | 144 | | |
| |||
0 commit comments