Cross compilation of Go on OSX

My main development machine is a Macbook Pro Retina (running OSX naturally), but our production servers all run Ubuntu.

The vast majority of our platform is built on Ruby, so we've never needed to consider compilation for particular platforms. I rather naively assumed that I'd just run go build, send the binary over to the server and launch it.

This is obviously not the case, but luckily getting cross complication setup was pretty straight forward following the instructions on this blog post.

I initially installed from the Go binary distribution package from here: Go Downloads so in order for me to build all the libraries for the other platforms I had to do the following:

cd /usr/local/go/src  
./all.bash

The rest was exactly the same as the blog post (no need to install Go from source).