Go’s success with the “gofmt” tool

I just ran across a discussion of gofmt, and I feel like the author definitely gets it, but there’s one piece to the puzzle he (or she? “Chris” is pretty ambiguous) neglected to mention. Laziness, pure and simple. He mentions that laziness wins when an opinionated person is trying to fight the convention in the context of the community, but what about those of us who don’t care about the community?

I hated the format choices in a lot of ways early on. I still dislike some of them. But my battle was never with the community; I decided early on that the Go zealots were just as nutty as the Python junkies or the Ruby fanboys. I don’t care about their conventions. I’ve explicitly built makefiles to avoid some of the (in my opinion) terrible decisions of go get and the GOPATH in general.

So why do I love gofmt now? I’m fucking lazy. Super lazy. I hate thinking. In most languages I try to adopt conventions to make my code readable for me, and fuck anybody else who wants to read my code. I care about me. But whatever conventions I come up with, they inevitably change over time, or I forget some nuance, or I just don’t have time to deal with making sure I wrote code per my conventions. gofmt lets me ignore so many of these everyday thoughts that I say, all right, I don’t love these conventions, but I get ’em free, so … now I love them.

Add in other conventions about which tools can notify us: comment styling, variable naming, redundant package names, etc. I think these tools have allowed me to just not care about conventions in 95% of the situations I used to care.

Now some people will argue that these kinds of thoughts only take a fraction of a second. Do I use camelcase or underscores? Ah, we’re doing Python (or Ruby), so underscores it is! Not a lot of thought involved. But those thoughts happen hundreds of times every single day. Maybe thousands when I have to switch projects a lot. Go’s tools let me keep the project in my head, not the rules or conventions. This is a huge benefit for me.

Now if only they could get their new dependency management thing figured out so I can stop hating go get….

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.