Skip to content

Instantly share code, notes, and snippets.

@mohae
Last active September 12, 2015 05:28
Show Gist options
  • Select an option

  • Save mohae/7e738af18e5041ac3fc4 to your computer and use it in GitHub Desktop.

Select an option

Save mohae/7e738af18e5041ac3fc4 to your computer and use it in GitHub Desktop.
Install Go 1.5 with $HOME/go as the workspace. Install is consistent with https://golang.org/doc/install
#!/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
# change the tarball for different version/arch
wget https://storage.googleapis.com/golang/go1.5.linux-amd64.tar.gz -O /tmp/go.tar.gz
sudo tar -C /usr/local -xzf /tmp/go.tar.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment