Useful Go Command [2]: golint

Baris Eser
1 min readApr 30, 2022

There are tools that help to enforce this style. The first is called golint. (The term “linter” comes from the Unix team at Bell Labs; the first linter was written in 1978.) It tries to ensure your code follows style guidelines. Some of the changes it suggest include properly naming variables, formatting error messages, and placing comments on public methods and types.

These aren’t errors; they don’t keep your programs from compiling or make your program run incorrectly. Also, you cannot automatically assume that golint is 100% accurate; because the kinds of issues that golint finds are more fuzzy, it sometimes has false positives and false negatives. This means that you don’t have to make the changes that golint suggests. But you should take the suggestions from golint seriously. Go developers expect code to look a certain way and follow certain rules, and if your code does not, it sticks out. (Learning Go — O’Reilly)

go install golang.org/x/lint/golint@latestgolint ./...

--

--