Created
May 5, 2020 17:35
-
-
Save apathor/893cfcb49605a3b364d5aa288a0f3be8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ; -*-shell-script-*- | |
# goenv bash config | |
goenv_setup() { | |
# the bin directory | |
local bin="${1:-$HOME/bin}" | |
local ver="${2:-1.14.1}" | |
# the goenv directory | |
local dir="${3:-$HOME/.goenv}" | |
# clone goenv | |
if ! [ -d "$dir" ]; then | |
git clone "https://github.com/syndbg/goenv.git" "$dir" | |
if (($?)); then printf "Problem cloning goenv repo." >&2; return 1; fi | |
fi | |
# link to the goenv bin | |
if ! [ -x "$bin/goenv" ]; then | |
ln -s "$dir/bin/goenv" "$bin/goenv" | |
fi | |
# initialize | |
eval "$(goenv init -)" | |
# setup goenv | |
if ! goenv install -s "$ver"; then | |
printf "Problem installing go version %s!\n" "$ver" >&2; | |
return 2 | |
fi | |
goenv shell "$ver" | |
goenv rehash | |
# install some useful packages | |
while read -r pkg; do | |
go get -v -u "$pkg" | |
done <<EOF | |
github.com/LK4D4/vndr | |
github.com/aaronjanse/3mux | |
github.com/anthonynsimon/bild | |
github.com/davecgh/go-spew | |
github.com/gizak/termui | |
github.com/go-delve/delve/cmd/dlv | |
github.com/golang/protobuf/proto | |
github.com/golangci/golangci-lint/... | |
github.com/google/pprof | |
github.com/gopasspw/gopass | |
github.com/jroimartin/gocui | |
github.com/junegunn/fzf | |
github.com/k0kubun/pp | |
github.com/knes1/elktail | |
github.com/kubernetes/minikube/... | |
github.com/manifoldco/promptui | |
github.com/mkouhei/gosh | |
github.com/motemen/gore | |
github.com/mozilla/sops | |
github.com/nsf/gocode | |
github.com/rogpeppe/godef | |
github.com/xo/usql | |
golang.org/x/tools/cmd/... | |
EOF | |
} | |
# initialize goenv if available | |
if type goenv &> /dev/null; then | |
eval "$(goenv init -)" | |
export PATH="$PATH:$GOPATH/bin" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment