Today I was staring at some code that I wrote a while back that had variables p and rn passed around everywhere. After figuring out what the hell those actually were (the absolute path to a file and the relative name of it) I decided to fix these names once and for all. Gofmt should handle that better than my editor as just p can be tricky to search and replace on.
I have pushed a few commits recently when I changed protobuf libraries across a number of repositories. Having the gofmt command in the commit made it clear.
gofmt’s rewrite expressions take a single letter to be a place holder matching any identifier
I’ve been thrown off by single letter wildcards in gofmt more than once. Isn’t it counterintuitive? Go encourages short and single letter name for variables but when you want to operate on them with gofmt, you need to make an extra effort to not hodor hodor hodor.