Created
August 3, 2017 23:36
-
-
Save jboelter/bf13793b0ef739a393a7b29903eeebaf to your computer and use it in GitHub Desktop.
Setup go 1.8.3 + gvt + tools for Visual Code
This file contains hidden or 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
#!/bin/bash | |
set -x -e | |
# This script will attempt to fetch the go version specified below | |
# and install the tools required by vs-code + the metalinter. | |
# The binaries will be copied to $HOME/bin | |
# You might be prompted. Linux only for now. | |
GO_VERSION_WANT='1.8.3' | |
if ! [ -d "$HOME/bin" ]; then | |
exit "expected ~/bin to exist (and it should be in your path)" | |
fi | |
TMP_FOLDER=$(mktemp -d 2>/dev/null || mktemp -d -t 'tmp.XXX' 2>/dev/null) | |
if ! [ -d $TMP_FOLDER ]; then | |
exit "failed to make temp dir" | |
fi | |
pushd $TMP_FOLDER | |
GO_VERSION=$(go version 2>1) | |
if [ ! -x "$(command -v go)" ] || [[ ! "$GO_VERSION" =~ "$GO_VERSION_WANT" ]]; then | |
echo "Wanted Go Version $GO_VERSION_WANT, but found $GO_VERSION" | |
echo "Installing go using godeb (linux)" | |
wget -qO- https://godeb.s3.amazonaws.com/godeb-amd64.tar.gz | tar xvz | |
godeb install $GO_VERSION_WANT | |
fi | |
GOPATH=$(pwd) | |
echo "running go commands" | |
$(go get -u github.com/nsf/gocode) | |
$(go get -u github.com/rogpeppe/godef) | |
$(go get -u github.com/zmb3/gogetdoc) | |
$(go get -u github.com/golang/lint/golint) | |
$(go get -u github.com/ramya-rao-a/go-outline) | |
$(go get -u sourcegraph.com/sqs/goreturns) | |
$(go get -u golang.org/x/tools/cmd/gorename) | |
$(go get -u github.com/tpng/gopkgs) | |
$(go get -u github.com/acroca/go-symbols) | |
$(go get -u golang.org/x/tools/cmd/guru) | |
$(go get -u github.com/cweill/gotests/...) | |
$(go get -u golang.org/x/tools/cmd/godoc) | |
$(go get -u github.com/fatih/gomodifytags) | |
$(go get -u github.com/josharian/impl) | |
$(go get -u gopkg.in/alecthomas/gometalinter.v1) | |
$(mv bin/gometalinter.v1 bin/gometalinter) | |
$(bin/gometalinter --install) | |
$(cp bin/* $HOME/bin) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment