mirror of
https://github.com/jimeh/dotfiles.git
synced 2026-02-19 08:26:42 +00:00
fix: ensure goenv is always loaded so GOPATH is correctly set
The lazy-loading could lead to incorrect GOPATH values in sub-shells and tmux instances which inherited a old GOPATH value from the parent shell. This is mostly an issue when new Go versions are installed, but it's still an issue. Hence I now always load goenv in the background ensuring it sets GOPATH correctly regardless of any existing GOPATH value.
This commit is contained in:
@@ -8,31 +8,14 @@
|
||||
|
||||
# install goenv
|
||||
zinit ice wait lucid as'program' pick'bin/goenv' from'gh' \
|
||||
atclone'src/configure && make -C src' atpull'%atclone' nocompile'!'
|
||||
atclone'src/configure && make -C src; ../libexec/goenv init - > zgoenv.zsh' \
|
||||
atpull'%atclone' src'zgoenv.zsh' nocompile'!'
|
||||
zinit light syndbg/goenv
|
||||
|
||||
zinit ice wait lucid as'program' pick'plugins/go-build/bin/go-build' from'gh' \
|
||||
id-as'syndbg/go-build'
|
||||
zinit light syndbg/goenv
|
||||
|
||||
# lazy-load goenv
|
||||
goenv() {
|
||||
load-goenv
|
||||
goenv "$@"
|
||||
}
|
||||
|
||||
_goenv() {
|
||||
load-goenv
|
||||
_goenv "$@"
|
||||
}
|
||||
|
||||
compctl -K _goenv goenv
|
||||
|
||||
load-goenv() {
|
||||
unset -f load-goenv _goenv goenv
|
||||
eval "$(command goenv init -)"
|
||||
}
|
||||
|
||||
# ==============================================================================
|
||||
# global golang packages
|
||||
# ==============================================================================
|
||||
|
||||
Reference in New Issue
Block a user