Port to Go

Most of the way there.

Blocked by http://play.golang.org/p/Ao77NzQWQv