I'm not an expert on this - but here are my notes on doing it for Ubuntu 9.10, done in May 2010.

Go needs mercurial - a code management system. This is written in python - python is installed. Need to ensure that ubuntu's repository - Universal - is activated. Do this by:



system/admin/ software sources, 
and tick the 'Community maintained....Universe'  one

You then select a server and then click Choose Server (not the Revert button, the other one.) Some stuff downloads for 2 mins.

the following notes use info, commands by pshahmumbai (excellent) at http://pshahmumbai.wordpress.com/2009/11/14/installing-go-programming-language-on-ubuntu-linux/

Here is the main text, in case that page vanishes.

1. Install mercurial (source code management tool) to fetch the “Go” source code : type: (or copy from an editor, and use edit>paste in terminal)


sudo apt-get install mercurial

2. Installing other stuff that you need to build “Go” : type:


sudo apt-get install bison gcc libc6-dev ed make
3. Create a folder called “go” in your home directory for all our “Go” files : At console, type:

cd ~
mkdir $HOME/go
mkdir $HOME/go/bin
mkdir $HOME/go/src

4. Setup some environment variables Type:



export GOROOT=$HOME/go/src
export GOARCH=386
export GOOS=linux
export GOBIN=$HOME/go/bin
export PATH=$PATH:$GOBIN

(Valid values for GOARCH are amd64 (for 64-bit x86), 386 (for 32-bit x86) and arm (for 32-bit ARM) I am using 386 for a standard win7 laptop.

5. Fetch the “Go” source code using the mercurial tool that we installed in first step :


hg clone -r release https://go.googlecode.com/hg/ $GOROOT

6. Build “Go” . type :



cd $GOROOT/src
./all.bash

7. If everything is good to “Go” then it will finish by printing :



— --- cd ../test
N known bugs; 0 unexpected bugs

8. We are ready to “Go” :) The binaries are available in your $HOME/go/bin directory. You can add it to your bash shell path permanently by adding these line to your ~/.bashrc file :



export GOROOT=$HOME/go/src
export GOARCH=386
export GOOS=linux
export GOBIN=$HOME/go/bin
export PATH=$PATH:$HOME/go/bin

(nb you can find this file by using the file browser, selecting view>show hidden files)

9. Depending on the GOARCH that you selected in step 4, the “Go” executables are :



386 => 8g (compiler), 8l (linker)
amd64 => 6g (compiler), 6l (linker)
ARM => 5g (compiler), 5l (linker)

(note : its small letter “L” and not number 1)

All these “Go” executables are available at $HOME/go/bin directory. Detailed instruction available at “Go” website http://golang.org/doc/install.html Depending on the architecture the commands will be different. Since I am using the 386 version, it is 8g (compiler) and 8l (linker) in my case. See above (step 9) which command to use for your case :



 $8g hello.go
 $8l hello.8

(Again note : It is small letter “L” and not number 1, as in 8l) 3. An executable called ./8.out is placed in the same directory. Now, run our first “Go” programs as :


 $./8.out