Skip to content

Instantly share code, notes, and snippets.

@mohae
Last active February 23, 2016 22:24
Show Gist options
  • Save mohae/8dd3e49e9351460467b7 to your computer and use it in GitHub Desktop.
Save mohae/8dd3e49e9351460467b7 to your computer and use it in GitHub Desktop.
Installs the current release of Go
#!/bin/bash
# For more info see https://golang.org/doc/install.html, the instructions there are all
# that is needed to install Go.
#
# DO NOT RUN with SUDO; Go should be installed under the user not root. Using sudo will
# cause problems. This script will install Go to /usr/local/go and create your workspace
# in your home directory: $HOME/go.
#
# The workspace is where all of the Go code will exist. Place your code in a subdirectory
# of $HOME/go/src. If you want your Go code (workspace) in a different location, change
# both the mkdir line and GOPATH to the location of your user's workspace.
#
# Please see https://golang.org/doc/code.html for more information about code organization.
mkdir ~/go
echo export 'GOPATH=$HOME/go' >> ~/.bashrc
echo export 'PATH=$PATH:/usr/local/go/bin:$GOPATH/bin' >> ~/.bashrc
source ~/.bashrc
# download and extract Go to /usr/local/go/
# change the tarball for different version/arch
wget -qO- https://storage.googleapis.com/golang/go1.6.linux-amd64.tar.gz | sudo tar xz -C /usr/local
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment