curl -s https://raw.githubusercontent.com/ikuamike/go-installer/master/go.sh | bash
Now, You can go grab a cup of coffee โ, set back ๐ and watch the magic happen! ๐ฎ
By default the script will create .go
and 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.
For example:
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
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 ๐