How to use it
Installing(or updating) Go
You can clone the repository or just use
wget to download the script
wget https://raw.githubusercontent.com/kerolloz/go-installer/master/go.sh bash go.sh
Now, You can go grab a cup of coffee
Please Note that
By default the script will create
go folders on your HOME directory, add the needed variables to your PATH variable.
$HOME/.go is location where Go will be installed to.
$HOME/go is the default workspace.
In order to install Go to other location or set custom workspace. You can set environment variables GOROOT or GOPATH before installing (or uninstalling) Go.
export GOROOT=/opt/go # where Go is installed export GOPATH=$HOME/projects/go # your workspace
Read more about workspaces in Go.
bash go.sh remove
How it works
The script does the following steps:
- checks if you have already installed Go!
- automatically checks the installed operating system (Linux or Mac)
- detects system architecture (armv6, armv8, amd64, i386)
- parses the golang download page to find the latest version of Go that is available for your platform and architecture
- in case of having already installed Go, if the latest and the current version are equal, the script exits
- downloads the latest version
- creates needed folders for workspace and Go binaries
- extracts the files of the downloaded package
- adds the binaries to PATH environmental variable
WORKS LIKE A CHARM
Tested by Travis
Tested manually on: