mirror of
https://github.com/kennyp/asdf-golang.git
synced 2024-10-05 20:22:06 +08:00
962a601cbd
Set `GOBIN`
18 lines
404 B
Bash
18 lines
404 B
Bash
asdf_update_golang_env() {
|
|
local go_bin_path
|
|
go_bin_path="$(asdf which go 2>/dev/null)"
|
|
if [[ -n "${go_bin_path}" ]]; then
|
|
export GOROOT
|
|
GOROOT="$(dirname "$(dirname "${go_bin_path:A}")")"
|
|
|
|
export GOPATH
|
|
GOPATH="$(dirname "${GOROOT:A}")/packages"
|
|
|
|
export GOBIN
|
|
GOBIN="$(dirname "${GOROOT:A}")/bin"
|
|
fi
|
|
}
|
|
|
|
autoload -U add-zsh-hook
|
|
add-zsh-hook precmd asdf_update_golang_env
|