Skip to content

Instantly share code, notes, and snippets.

@orian
Last active Aug 29, 2015
Embed
What would you like to do?
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