Well, here we are again. Another installer script. We want to make sure that everyone’s using the right version of Go, so here it is.
This script only works for 64-bit Linux machines. Like, say, a campus machine.
You’re welcome to set up Go on your own. You don’t have to use the script. You do have to use the correct version of the Go compiler.
I mean, here you are reading it, so you’ll probably realize very quickly that it’s not hard to do. It boils down to the following:
If anything fails during this process, we want to bail right away.
The SHA256 sum for the version of Go that we want.
Get it from Google’s servers
echo "" echo "**Downloading tarball**" echo "" wget https://redirector.gvt1.com/edgedl/go/go1.9.2.linux-amd64.tar.gz
Check its sha256 sum to make sure it downloaded correctly. No corruption or other funny business.
echo "" echo "**Verifying downloaded tarball**" echo "" echo $DOWNLOAD_SUM | sha256sum -c -
Unpack the download.
It’ll unpack to a new, local directory named
echo "" echo "**Unpacking Go from downloaded tarball**" echo "" tar xf go1.9.2.linux-amd64.tar.gz
Now that it’s unpacked, we don’t really need the original download anymore.
echo "" echo "**Removing downloaded tarball**" echo "" rm go1.9.2.linux-amd64.tar.gz
That’s it! Time to use it.
echo "" echo "**I'm done!**" echo "" echo "You can get to 'go' with the following:" echo -e "\tGOROOT=\"\$(pwd)/go\" ./go/bin/go --help" echo "" echo "Check the version like this:" echo -e "\tGOROOT=\"\$(pwd)/go\" ./go/bin/go version"