mirror of
https://github.com/jimeh/dotfiles.git
synced 2026-02-19 12:46:39 +00:00
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.
51 lines
1.5 KiB
Bash
Executable File
51 lines
1.5 KiB
Bash
Executable File
#
|
|
# Go (golang) environment setup.
|
|
#
|
|
|
|
# ==============================================================================
|
|
# goenv
|
|
# ==============================================================================
|
|
|
|
# install goenv
|
|
zinit ice wait lucid as'program' pick'bin/goenv' from'gh' \
|
|
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
|
|
|
|
# ==============================================================================
|
|
# global golang packages
|
|
# ==============================================================================
|
|
|
|
install_go_global_packages() {
|
|
local packages=(
|
|
github.com/akavel/up
|
|
github.com/asciimoo/wuzz
|
|
github.com/cweill/gotests/...
|
|
github.com/go-delve/delve/cmd/dlv
|
|
github.com/golang/mock/gomock
|
|
github.com/golang/mock/mockgen
|
|
github.com/kisielk/errcheck
|
|
github.com/mdempsky/unconvert
|
|
github.com/rogpeppe/godef
|
|
golang.org/x/lint/golint
|
|
golang.org/x/tools/cmd/godoc
|
|
golang.org/x/tools/cmd/goimports
|
|
golang.org/x/tools/cmd/guru
|
|
golang.org/x/tools/gopls
|
|
)
|
|
|
|
for package in "${packages[@]}"; do
|
|
echo "installing/updating \"$package\""
|
|
go get -u "$package"
|
|
done
|
|
|
|
if command-exists goenv && [ "$(goenv version-name)" != "system" ]; then
|
|
echo "running: goenv rehash..."
|
|
goenv rehash
|
|
fi
|
|
}
|