How I Learned to Stop Worrying and Love Golang

“Here’s a riff on Malcolm Gladwell’s rule of thumb about mastery: you don’t really know a programming language until you’ve written 10,000 lines of production-quality code in it. Like the original this is a generalization that is undoubtedly false in many cases – still, it broadly matches my intuition for most languages and most programmers1. At the beginning of this year, I wrote a sniffy post about Go when I was about 20% of the way to knowing the language by this measure. Today’s post is an update from further along the curve – about 80% – following a recent set of adventures that included entirely rewriting’s core dispatcher in Go. My opinion of Go has changed significantly in the meantime. Despite my initial exasperation, I found that the experience of actually writing Go was not unpleasant. The shallow issues became less annoying over time (perhaps just due to habituation), and the deep issues turned out to be less problematic in practice than in theory. Most of all, though, I found Go was just a fun and productive language to work in. Go has colonized more and more use cases for me, to the point where it is now seriously eroding my use of both Python and C.

After my rather slow Road to Damascus experience, I noticed something odd: I found it difficult to explain why Go worked so well in practice. Sure, Go has a triad of really smashing ideas (interfaces, channels and goroutines), but my list of warts and annoyances is long enough that it’s not clear on paper that the upsides outweigh the downsides. So, my experience of actually cutting code in Go was at odds with my rational analysis of the language, which bugged me. I’ve thought about this a lot over the last few months, and eventually came up with an explanation that sounds like nonsense at first sight: Go’s weaknesses are also its strengths. In particular, many design choices that seem to reduce coherence and maintainability at first sight actually combine to give the language a practical character that’s very usable and compelling. Lets see if I can convince you that this isn’t as crazy as it sounds…”