-
-
Save denkhaus/d29e10eaebd445cbce52 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
#!/usr/bin/env bash | |
# | |
# Example usage: | |
# | |
# $ VERSION=1.2.2 sudo ./goinst.sh | |
if [ "$(id -u)" != "0" ]; then | |
echo "This script must be run as root" 1>&2 | |
exit 1 | |
fi | |
test "$VERSION" || VERSION=1.2.2 | |
set -ex | |
TDIR=`mktemp -d` | |
#trap "{ cd - ; rm -rf $TDIR; exit 255; }" SIGINT | |
cd $TDIR | |
wget https://storage.googleapis.com/golang/go$VERSION.linux-amd64.tar.gz | |
rm -rf /usr/local/go | |
tar -C /usr/local -xzf go$VERSION.linux-amd64.tar.gz | |
echo 'export GOPATH=~/dev/gocentral' >> ~/.bashrc | |
echo 'export PATH=$PATH:$GOPATH/bin' >> ~/.bashrc | |
echo 'export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin' >> /etc/profile.d/golang.sh | |
cd - | |
rm -rf $TDIR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment