Linting your Go code
You should lint your code! Pretty much everyone agrees that you should do this. Linters are tools of varying degrees of sophistication that attempt to help you avoid dangerous situations with your code, and coding is hard enough that such automated help is invaluable.
The Go programming language was designed to have a relatively simple syntax and to compile quickly, which means it is also straightforward to write a linter for the language. So lots of people did! Eventually their efforts got collected in a meta-linter called golangci-lint. That linter just had version 2 released, so its a good time to talk about its configs.
Here’s the configs for Triple Pat’s Go code. The config is actually a pretty strict one, and I encourage you to be strict when setting up a new project. Linting cleanly is hard to put in an existing project, but is easy to do in the beginning. Start your projects off right!
How does our config differ from yours? What should we do differently?
Contribute to the discussion by replying on BlueSky!