A curated list of awesome Go linters. More than 60 linters and tools!
Switch branches/tags
Nothing to show
Clone or download
jirfag Merge pull request #6 from Quasilyte/patch-1
readme: add go-consistent and go-namecheck
Latest commit a87000d Nov 16, 2018
Permalink
Failed to load latest commit information.
LICENSE Initial commit Mar 10, 2018
README.md readme: add go-consistent and go-namecheck Nov 15, 2018
go.png Add go.png Mar 10, 2018
main.go Create main.go Mar 10, 2018

README.md

Awesome Go Linters

A curated list of awesome Go linters.

Sponsored by GolangCI: SaaS service for running linters on Github pull requests. Free for Open Source.

Contents

Cloud Linters

Go Focused

  • GolangCI - Open Source SaaS service for running linters on Github pull requests. Free for Open Source.
  • Golint online - Lints online Go source files on GitHub, Bitbucket and Google Project Hosting using the golint package.
  • GopherCI - GopherCI helps you maintain high-quality Go projects, by checking each GitHub Pull Request, for backward incompatible changes, and a suite of other tests.
  • Go Report Card - Go repo report card.

General Purpose

  • CodeClimate - The open and extensible static analysis platform.
  • CodeFactor - Automated Code Analysis for repos on GitHub or BitBucket.
  • HoundCI - Code review tool for GitHub pull requests
  • QuantifiedCode - Automated code review & repair
  • Scrutinizer - A proprietery code quality checker that can be integrated with GitHub
  • SideCI - An automated code reviewing tool. Improving developers' productivity.

Linters

Code Formatting

  • gofmt - Gofmt formats Go programs. Must have for every project. Don't forget to use -s flag.
  • goimports - Goimports does everything that gofmt does. Additionally it checks unused imports.
  • unindent - Report code that is unnecessarily indented

Code Complexity

  • abcgo - ABC metrics for Go source code.
  • depth - Count the maxdepth of go functions. It's helpful to see if a function needs to be splitted into several smaller functions, for readability purpose.
  • gocyclo - Computes and checks the cyclomatic complexity of functions.
  • nakedret - nakedret is a Go static analysis tool to find naked returns in functions greater than a specified function length.
  • splint - It finds any functions that are too long or have too many parameters or results.

Style and Patterns Checking

  • dupl - Tool for code clone detection.
  • go-checkstyle - checkstyle is a style check tool like java checkstyle. This tool inspired by java checkstyle, golint. The style refered to some points in Go Code Review Comments.
  • go-cleanarch - go-cleanarch was created to validate Clean Architecture rules, like a The Dependency Rule and interaction between packages in your Go projects.
  • go-consistent - source code analyzer that helps you to make your Go programs more consistent.
  • go-namecheck - source code analyzer that helps you to maintain variable/field naming conventions inside your project.
  • gochecknoinits - Find init functions, to reduce side effects in code.
  • gochecknoglobals - Find global vars, to reduce side effects in code.
  • goconst - Find in Go repeated strings that could be replaced by a constant.
  • GoLint - Golint is a linter for Go source code.
  • gosimple - gosimple is a linter for Go source code that specialises on simplifying code.
  • impi - Verify imports grouping and ordering.
  • interfacer - Linter that suggests narrower interface types.
  • lll - Line length linter, used to enforce line length in files.
  • misspell - Finds commonly misspelled English words
  • nofuncflags - disallow boolean params to functions (flags).
  • revive - ~6x faster, stricter, configurable, extensible, and beautiful drop-in replacement for golint
  • unconvert - Remove unnecessary type conversions from Go source.
  • usedexports - Find in Go exported variables that could be unexported.

Bugs

  • apicompat - Checks recent changes to a Go project for backwards incompatible changes.
  • badtime - Badtime is a Golang linter that detects inappropriate usage of the time.Time struct.
  • durcheck - durcheck is a very simple linter which detects potential bugs with time.Duration in a Go package.
  • enumlinter - Enum linter for enumerated types in Go.
  • errcheck - Errcheck is a program for checking for unchecked errors in Go programs.
  • gas - Inspects source code for security problems by scanning the Go AST.
  • go vet - Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string. Can check shadowing of variables, but must be enabled explicitly.
  • mulint - Go lint which detects recursive locks, which may lead to dead locks.
  • safesql - Static analysis tool for Golang that protects against SQL injections.
  • scopelint - scopelint checks for unpinned variables in go programs.
  • staticcheck - staticcheck is go vet on steroids, applying a ton of static analysis checks you might be used to from tools like ReSharper for C#.

Unused Code

  • deadcode - Finds unused code.
  • ineffassign - Detect when assignments to existing variables are not used.
  • structcheck - Find unused global variables and constants.
  • unparam - Report unused function parameters.
  • unused - unused checks Go code for unused constants, variables, functions and types.
  • varcheck - Find unused global variables and constants.

Performance

  • aligncheck - Warn about un-optimally aligned structures.
  • Copyfighter - Statically analyzes Go code and reports functions that are passing large structs by value.
  • maligned - Tool to detect Go structs that would take less memory if their fields were sorted.
  • prealloc - Find slice declarations that could potentially be preallocated.

Reports

  • flen - Get info on length of functions in a Go package.
  • GoReporter - A Golang tool that does static analysis, unit testing, code review and generate code quality report.
  • golinters - golinters generates HTML reports about Go linters.

Misc

  • go-outdated - Console application that displays outdated packages.
  • go-template-lint - go-template-lint is a linter for Go text/template (and html/template) template files.
  • godox - Find all TODO/FIXME comments.
  • lingo - Set of specific checks.
  • megacheck - megacheck runs staticcheck, gosimple and unused at once. Because it is able to reuse work, it will be faster than running each tool separately.
  • go-critic - source code linter that brings checks that are currently not implemented in other linters.
  • tarp - tarp finds functions and methods without direct unit tests in Go source code.

Linters Helper Tools

  • Go Metalinter - Metalinter is a tool to automatically apply all static analysis tool and report their output in normalized form.
  • lint - Run linters as part of go test.
  • revgrep - Filters output from static analysis tools, showing only recently changed lines of code
  • reviewdog - "reviewdog" provides a way to post review comments to code hosting service, such as GitHub, automatically by integrating with any linter tools with ease.
  • zb - speedup linting by caching gometalinter result.