hg clone -r release https://go.googlecode.com/hg/ go
Now to compile the Go compiler for the architecture of your machine, simply cd into the go/src directory and run the all.bash script
cd go/src; ./all.bashIf you want to create compilers for a different architecture you set the GOARCH environment variable and then run the make.bash script.
GOARCH=arm ./make.bash
GOARCH=386 ./make.bash
GOARCH=amd64 ./make.bash
The all.bash script compiles the compiler and runs the unit tests, the make.bash script just compiles the compilers.
This will create separate compilers, linkers and assemblers for each of the three architectures. Because each compiler, linker and assembler have a different name you can have support all architectures simultaneously.
Once you have the Go compilers compiled you can now compile your project for different architectures by creating a Go Makefile and setting the GOARCH environment variable before typing make.
GOARCH=arm make
GOARCH=386 make
GOARCH=amd64 make
That's it! You can now cross compile your Go code. More information on the Go compilers, creating a Go Makefile and getting started with Go can be found here, here, and here respectively. Happy Hacking!