Created
October 3, 2015 13:04
-
-
Save higebu/2047d6198880097f27ab to your computer and use it in GitHub Desktop.
Script for golang installation
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 -e | |
GO_VERSION=1.5.1 | |
dir=$(mktemp -d) | |
pushd $dir | |
# Remove old version | |
sudo rm -rf /usr/local/go | |
# Download new version | |
wget https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz | |
# Extract into /usr/local | |
sudo tar -C /usr/local -xvf go${GO_VERSION}.linux-amd64.tar.gz | |
# Cleanup | |
popd | |
rm -rf ${dir} | |
# echo the commands for setting up environment variables | |
echo 'For the first time, you may want to run following command. | |
cat <<EOF >> $HOME/.profile | |
export PATH="/usr/local/go/bin:$PATH" | |
export GOROOT="/usr/local/go" | |
export GOPATH=$HOME/go | |
export PATH="$GOROOT/bin:$GOPATH/bin:$PATH" | |
EOF' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment