Improving code quality metrics with the help of linters

Linters are specialized static analysis tools that parse Go files and attempt to detect, flag, and report cases where the following occurs:

  • The code does not adhere to the standard formatting style guide; for example, it contains extraneous whitespace, is incorrectly indented, or contains comments with spelling typos
  • The program contains possible logic bugs; for example, a variable declaration shadowing a previous variable declaration with the same name, calling functions such as fmt.Printf with an incorrect argument count or with arguments whose types do not match the format string, assigning values to variables but not actually using them, not checking errors returned by function ...

Get Hands-On Software Engineering with Golang now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.