asdf-golang/set-env.zsh
Eddie 21d9c329bb
Use built-in zsh function to get absolute dir path for golang (#105)
Co-authored-by: Edwin Galdamez <egaldamez@gumgum.com>
2023-05-23 21:14:14 -04:00

12 lines
251 B
Bash

asdf_update_golang_env() {
local go_path
go_path="$(asdf which go)"
if [[ -n "${go_path}" ]]; then
export GOROOT
GOROOT="$(dirname "$(dirname "${go_path:A}")")"
fi
}
autoload -U add-zsh-hook
add-zsh-hook precmd asdf_update_golang_env