Monthly Archives: July 2010

Notes about Google Go

While trying out Google Go, I found out whitespace seriously matters, certain constructs you’re used to are not present, there is more than one way to declare variables, etc. This is a short collection of those observations.


Blocks cannot have a newline between the declaration and the first opening brace.
[gist id=”487680″]
This is a bit strange, as many people think that having all the curly braces in line is more readable, and it is a common practice in many languages to do so. I’ve recently converted to this line of thinking, but I’ll have to revert back to hanging curlies for Go. I’m OK with this, it’s just weird that it actually enforces one side of this hotly-debated topic.

Environment Variables

There might be a way to get rid of this, and I think it’s nice that you can point Go to a specific location for libraries, it would be nice if the default installation didn’t force me to update my .bashrc.


So, to start, I realize I can use gccgo for a more traditional compilation process, but I’d like to use the most feature-rich version of the language. Why does go have 2 different binaries for compiling and linking? Also, the naming scheme, while I think I understand where they’re coming from, is ridiculous. Should I use 8g or 6g? I don’t know – why is it not go and go64? That would actually be easy to remember. For reference, 8g is for i686, and 6g is for amd64. I don’t get it. So, I’m ready to compile, and I just run 8g myfile.go right? Yes, then I have to run 8l myfile.8. Wait, if I use 6g I get a different file extension! This makes for horrendous Makefiles that I’ll have to manage somehow. Perhaps I’ll just do everything with Scons instead, since I think it wouild be a lot cleaner.

I found a great post on Stack Overflow about how to hook this thing up to Scons. I ended up with this:

[gist id=”487779″]

Maybe someone at the Scons project will eventually integrate something like this into Scons…


So far, I’ve noticed there’s no pre-increment operator for integers like there is in C++. This is a bit annoying, but I’ll get over it.


There’s no while or do-while loops. Just a for loop. This makes me sad – I really like while and do-while loops for certain cases. I’m sure the for construct in Go is flexible enough to handle this omission, but it makes me uncomfortable at the moment. We’ll see if I like what they’ve done.


I like Google Go, but it’s going to take some getting used to.

Burst C++ Library

I made a little C++ library called burst. The idea is to extend the awesomeness of Boost with convenience functions for common tasks (mainly my own common tasks, but maybe others can benefit as well). The current trunk is here. Here’s a quick example:

[gist id=461014]

And just that quick (3 lines) you’re sending an HTTP request to’s root page and streaming the result to STDOUT. Pretty cool, eh? What if you want a different website?

[gist id=461015]

It’s nearly as easy as Ruby’s open-uri! Inheriting from it makes it even better, since you can quickly customize a web api class around the gory HTTP details Burst.Asio.HTTP.Client does for you.