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.

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:

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.

Leave a Reply

Your email address will not be published. Required fields are marked *