Created
December 13, 2016 18:02
-
-
Save thomas-scrace/8893f19a67c5590192d453fa277e15f0 to your computer and use it in GitHub Desktop.
Download and install the golang tools. Change variables to suit your purposes.
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 | |
# Downloads the specified version of go, unpacks it, | |
# deletes any existing version, and installs the new | |
# one globally. Needs root. | |
set -e | |
INSTALLDIR=/usr/local | |
GOROOT=$INSTALLDIR/go | |
VERSION=1.7.4 | |
OS=linux | |
ARCH=amd64 | |
TARFILE=go$VERSION.$OS-$ARCH.tar.gz | |
URL=https://storage.googleapis.com/golang/$TARFILE | |
curl $URL -LO | |
if [ -d "$GOROOT" ]; then | |
rm -r $GOROOT | |
fi | |
tar -C $INSTALLDIR -xzf $TARFILE | |
echo "export PATH=\$PATH:$GOROOT/bin" >>/etc/profile | |
source /etc/profile | |
rm $TARFILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment