Problem
When switching Go versions via goenv install / goenv local / goenv global, previously installed Go tools (e.g. gopls, dlv, staticcheck) are no longer available because each Go version has its own $GOPATH/bin. This causes IDE features (code navigation, auto-completion, diagnostics) to silently break.
Steps to Reproduce
- Install Go 1.23 via goenv, install gopls:
go install golang.org/x/tools/gopls@latest
- Switch to Go 1.24:
goenv local 1.24.10
- Run
gopls version → fails or picks up a stale shim
Expected Behavior
After switching Go versions, either:
- Go tools installed in the previous version should still be accessible, OR
- goenv should warn the user that tools need to be reinstalled, OR
- goenv should provide a mechanism (e.g.
goenv rehash --install-tools) to automatically reinstall a configured set of tools for the new version
Suggested Solutions (any of these would help)
- Post-switch hook: Allow users to define a list of tools in a config file (e.g.
~/.goenv/default-tools) that get auto-installed after version switch, similar to how nodenv has default-packages.
- Warning on shim miss: When a shim is invoked but the underlying binary doesn't exist for the current Go version, print a helpful error message suggesting
go install ... instead of a generic "not found".
- Shared tools directory: Optionally allow tools to be installed to a version-independent path so they survive version switches.
Environment
- goenv 2.2.23
- macOS (darwin/arm64)
- Shell: zsh
Problem
When switching Go versions via
goenv install/goenv local/goenv global, previously installed Go tools (e.g.gopls,dlv,staticcheck) are no longer available because each Go version has its own$GOPATH/bin. This causes IDE features (code navigation, auto-completion, diagnostics) to silently break.Steps to Reproduce
go install golang.org/x/tools/gopls@latestgoenv local 1.24.10gopls version→ fails or picks up a stale shimExpected Behavior
After switching Go versions, either:
goenv rehash --install-tools) to automatically reinstall a configured set of tools for the new versionSuggested Solutions (any of these would help)
~/.goenv/default-tools) that get auto-installed after version switch, similar to hownodenvhasdefault-packages.go install ...instead of a generic "not found".Environment