mirror of
https://github.com/jimeh/dotfiles.git
synced 2026-02-19 04:46:41 +00:00
feat(golang): use goenv to install and manage Go versions
This commit is contained in:
@@ -2,6 +2,37 @@
|
||||
# Go (golang) environment setup.
|
||||
#
|
||||
|
||||
# ==============================================================================
|
||||
# goenv
|
||||
# ==============================================================================
|
||||
|
||||
# install goenv
|
||||
zinit ice wait lucid as'program' pick'bin/goenv' from'gh' \
|
||||
atclone'src/configure && make -C src' atpull'%atclone' 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
|
||||
# ==============================================================================
|
||||
|
||||
8
zshenv
8
zshenv
@@ -137,10 +137,6 @@ path_append "/opt/flutter/bin/cache/dart-sdk/bin"
|
||||
# Use gnu-getop if available
|
||||
path_prepend "/usr/local/opt/gnu-getopt/bin"
|
||||
|
||||
# Go (golang) environment setup
|
||||
export GOPATH="$HOME/.go"
|
||||
path_prepend "$GOPATH/bin"
|
||||
|
||||
# Homebrew setup
|
||||
export HOMEBREW_NO_ANALYTICS=1
|
||||
|
||||
@@ -153,6 +149,10 @@ path_prepend "/opt/emacs/bin"
|
||||
# Use custom tmux install if available
|
||||
path_prepend "/opt/tmux/bin"
|
||||
|
||||
# Go setup for golang (./zsh/golang.zsh)
|
||||
path_prepend "$HOME/.goenv/shims"
|
||||
export GOENV_GOPATH_PREFIX="$HOME/.goenv/go"
|
||||
|
||||
# Ruby setup for rbenv (./zsh/ruby.zsh)
|
||||
path_prepend "$HOME/.rbenv/shims"
|
||||
path_prepend "$HOME/.rbenv/bin"
|
||||
|
||||
Reference in New Issue
Block a user