I like Go, but only when I don't have to write it

· gsg


I am on a quest to restore the joy I had in programming, and computing more generally. Being funemployed, I have been writing a lot of just-for-fun code lately. For my latest toy project, I am writing a simple regex matcher. The goal is to start with the didactic implementation, then graduate to a more robust one.

Stated preference #

Programming language choice always comes up when kicking off a new personal project, and my thought process is always the same:

Almost every time, answering those questions leads me to start the project in Go. Almost every time, I get side-tracked infinitely and drop the project. I thought the latter was just me being weak-willed, but I am now convinced it's because Go is not a good choice for me.

Papercuts #

The criteria above do seem solid to me, and I think Go is a great choice given those criteria. But then the following start to irk me:

  1. how do I install gopls and goimports again? 1
  2. how do I test this? Wow, I have to type so much just to get a single unit test... how should I refactor this? Oh no, that was too soon, let me undo that
  3. so much repetition in the code! How should I refactor this? Oh no, that was too soon, let me undo that
  4. I don't know what it is, but I can never learn anything from reading the docs
  5. let's just hope nothing goes wrong at runtime, because I haven't the first clue as to how that works

The code I was writing for fun because it was supposed to be elegant is now littered with the likes of if err != nil { return nil, err } and unnecessary assignments. When I come back to it to make a change, I have to read 300 lines to make sense of a simple thing. And the tests don't serve as documentation.

Revealed preference #

At one point in my regex matcher, when I was annoyed at having to write another 20-line for loop inside my function, I rm -rf'd it 2 and started over in Rust. The joy! Algebraic data types! Expressiveness! Multiple forms of iteration! Abstractions!

I have finally reflected on the experience and found what's missing in my declared preferences above: expressiveness. I expect expressiveness of a language.

Conclusion #

Maybe I'm still learning, and this is the hard part of learning a language. After all, I haven't written Go code in anger in significant amounts. But life's too short. For the last few weeks, this is what I've favored instead:

And this has been working great! Programming is more fun, insights are more pretty, cleverness is valued again. I'm like the flying dude from that xkcd. 3

I continue to "like" Go, and think it's a great idea, as long as it's written and read by others.


  1. this is 100% my fault, but those two always disappear from my PATH by the time I pick up the next project ↩︎

  2. pronounved: "rimraffed" ↩︎

  3. let's see how long until I fall into this other xkcd... ↩︎