Skip to content

Instantly share code, notes, and snippets.

@rdallman
Last active December 27, 2015 04:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rdallman/7271130 to your computer and use it in GitHub Desktop.
Save rdallman/7271130 to your computer and use it in GitHub Desktop.
Installs go, gets go.tools, gets go-doctor (for internal use)
#!/bin/bash
#
# run with ./goinstall.bash USERNAME=yourusernamehere
# e.g. ./goinstall.bash USERNAME=rpa0003
# Install latest Go from source
# Setup GOROOT and GOPATH
# Install go.tools
# get go from source
sudo apt-get install mercurial
hg clone -u release https://code.google.com/p/go $HOME/go
cd $HOME/go
# update to tip
hg update default
cd src
# compile
./all.bash
# for go projects
mkdir $HOME/gocode
# add env variables to path
echo GOPATH=$HOME/gocode >> ~/.bashrc
echo GOROOT=$HOME/go >> ~/.bashrc
echo PATH=$GOPATH/bin:$GOROOT/bin:$PATH >> ~/.bashrc
# update
source ~/.bashrc
# get go.tools for importer/oracle/etc.
go get code.google.com/p/go.tools
# get go-doctor
cd $GOPATH/src
sudo apt-get install git
git clone ssh://$USERNAME@git.openrefactory.org/gitroot/go-doctor.git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment