Skip to content

Instantly share code, notes, and snippets.

@orian
Last active August 29, 2015 14:07
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 orian/5707bed72956ace827b5 to your computer and use it in GitHub Desktop.
Save orian/5707bed72956ace827b5 to your computer and use it in GitHub Desktop.
Go install script
#!/bin/bash
# 1. Save file as go_install.sh
# 2. chmod +x go_install.sh
# 3. ./go_install.sh
# 4. Profit.
# Get Go package
PKGNAME=go1.3.3.linux-amd64.tar.gz
rm -f $PKGNAME
wget https://storage.googleapis.com/golang/$PKGNAME
# set install dir (one of below must not be commented)
#GOINSTALLDIR=/usr/local
GOINSTALLDIR=$HOME/Downloads/software
echo "Will install in: $GOINSTALLDIR"
# extract
sudo tar -C $GOINSTALLDIR -xzf go1.3.3.linux-amd64.tar.gz
# set for this session
export GOROOT=$GOINSTALLDIR/go
export PATH=$PATH:$GOROOT/bin
# set for future sessions
echo "Setting GOROOT and PATH."
echo "export GOROOT=$GOROOT" >> $HOME/.bashrc
echo "export PATH=\$PATH:$GOROOT/bin" >> $HOME/.bashrc
echo "Success."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment