asdf-golang icon indicating copy to clipboard operation
asdf-golang copied to clipboard

Add dynamic GOROOT setting for zsh

Open austince opened this issue 3 years ago • 1 comments

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

austince avatar Jun 17 '21 16:06 austince

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

Rainshaw avatar Mar 11 '22 14:03 Rainshaw

the PR has been pending almost 2 years now :O (and the issue has been active for 3 years)

hjpotter92 avatar Apr 27 '23 06:04 hjpotter92

Thank you for merging and your ongoing maintenance 🎉

edwardloveall avatar May 10 '23 00:05 edwardloveall