asdf-golang
asdf-golang copied to clipboard
Add dynamic GOROOT setting for zsh
Uses the same approach as the Java plugin (https://github.com/halcyon/asdf-java#java_home) to set the GOROOT
env variable before commands, so no manual setting is necessary.
I've only implemented zsh
right now, but could add bash
, fish
, xonsh
, etc.
Partially fixes #28 – not sure if this plugin should set GOPATH
thank for your script, i made it a little faster by a small change
asdf_update_golang_env() {
local go_root
go_root="$(asdf where golang)"
if [[ -n "${go_root}/go" ]]; then
export GOROOT
GOROOT="${go_root}/go"
fi
}
autoload -U add-zsh-hook
add-zsh-hook precmd asdf_update_golang_env
the PR has been pending almost 2 years now :O (and the issue has been active for 3 years)
Thank you for merging and your ongoing maintenance 🎉