Last active
June 12, 2021 14:52
-
-
Save scottjbarr/00b4d037c71f8547f58cd838e0aef7a8 to your computer and use it in GitHub Desktop.
Install a particular version of Go, and a .goconfig to setup your shell
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
# source this file from your .bash_profile | |
export GOROOT=~/.go/versions/go1.10.3 | |
export GOPATH=~/p/go | |
export PATH=$GOROOT/bin:$GOPATH/bin:$PATH |
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 | |
# | |
# Download and install a particular version of Go. | |
# | |
# Assumes versions are installed at ~/.go/versions/ | |
# | |
# Author : Scott Barr | |
# Date : 23 Apr 2016 | |
# | |
if [ $# -ne 1 ]; then | |
echo "Please supply Go version eg. go1.6.2" | |
exit 1 | |
fi | |
if [ ! -d ~/.go/versions ]; then | |
mkdir -p ~/.go/versions | |
fi | |
cd ~/.go/versions | |
version=$1 | |
if [ -d ${version} ]; then | |
echo "${version} already exists" | |
exit 2 | |
fi | |
filename=${version}.linux-amd64.tar.gz | |
url=https://storage.googleapis.com/golang/${filename} | |
wget ${url} | |
tar -zxf ${filename} | |
mv go ${version} | |
rm ${filename} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment