Google GO is a systems language Google uses on it’s own production instances. It’s nearly as fast as C++, has garbage collection, and can handle thousands of concurrent “routines”. When we started with GO, we followed the installation notes, but noticed a few other steps that needed to take place as well. We hope you find this walk through helpful.
Disclaimer: Hey, this is Appirio, right? Why a systems language? What’s that have to do w/ Cloud? The GO team is working w/ the Google App Engine team (no release date yet) and it already has huge ramifications on EC2 environments… we think it’ll be a major player down the road. Always healthy to stay ahead of the curve.
Prerequisites:
– Python (Mercurial requires Python)
– Mercurial (Source Control Management)
– XCode
– ~/bin directory with 755 permissions. (mkdir ~/bin then chmod 755 ~bin)
Here’s how to check your prerequisites, for reference:
Kyle-Roche-MPB:~ kyleroche$ python -V
Python 2.6.1
Kyle-Roche-MPB:~ kyleroche$ hg version
Mercurial Distributed SCM (version 1.5.4+20100601)
Copyright (C) 2005-2010 Matt Mackall
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Kyle-Roche-MPB:~ kyleroche$ xcodebuild -version
Xcode 3.2.2
Component versions: DevToolsCore-1648.0; DevToolsSupport-1631.0
BuildVersion: 10M2148
Adjust .bash_profile
Add the following code to your .bash_profile. If you don’t have one, create it in your ~ directory.
export GOROOT=$HOME/go
export GOOS=darwin
export GOARCH=386
export GOBIN=$HOME/bin
export PATH=$GOBIN:$PATH
Here’s how to check your profile, for reference:
Kyle-Roche-MPB:~ kyleroche$ source .bash_profile
Kyle-Roche-MPB:~ kyleroche$ env | grep ^GO
GOBIN=/Users/kyleroche/bin
GOARCH=386
GOROOT=/Users/kyleroche/go
GOOS=darwin
Pulling down the source package:
You can use Mercurial to pull down the package from Google Code. Run the following command:
Kyle-Roche-MPB:~ kyleroche$ hg clone -r release https://go.googlecode.com/hg/ $GOROOT
requesting all changes
adding changesets
adding manifests
adding file changes
added 5632 changesets with 22984 changes to 3660 files
updating to branch default2215 files updated, 0 files merged, 0 files removed, 0 files unresolved
Compile the package.
Final step… change to the $GOROOT/src directory. Run the following command:
Kyle-Roche-MPB:src kyleroche$ ./all.bash
There’s way too much output to be useful copying to this article. I noticed a different set of output then described in the installation guide. I think the safest way to test if it was successful is to go ahead and follow the Hello World example. If you’re confident that existence = success, you can always run which 8g or which 8l. Both of those files exists after the language is compiled.