Go Productivity — Go Linters
Have you ever wished you had a mentor who could quietly remind you, “YOU FORGOT THE RULE!” every time you make a coding mistake?
Or perhaps you’re trying to establish team guidelines, but you notice that team members frequently break them, either because they’re new or they just don’t feel like adhering to them?
Linters are tools that can serve as that mentor, catching errors in your code and explaining what’s wrong. Let’s dive into a quick example:
Here, MyStruct isn’t as efficient as it could be. Its size could shrink from 32 to 24 bytes with the right configuration.
“Really, I can change the size of a struct?”
If that’s news to you, you might want to check out my other article: “What is Alignment? A Small Change for a Huge Impact.”
What is Alignment? A Small Change for a Huge Impact
I get it, at first this seems a little boring. But to show why these details actually matter for performance, let’s…
This guide aims to walk you through installing linter-aggregator, setting it up, and customize it to your needs
1. What linter should I use?
Golint used to be the standard for checking Go code, but it’s no longer the go-to option. In its absence, new tools like revive, go-critic, govet,…
This has led to a sudden increase in different choices, making it sometimes hard to figure out what’s best for different needs and preferences.
“Huh, so which one now?”
Well, I’d like to point you toward golangci-lint. Despite its name suggesting it’s a single tool, it’s actually more of a linter bundle. Think of it as a…