Skip to content
This repository has been archived by the owner on Oct 29, 2021. It is now read-only.

golangci/awesome-go-linters

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

  • dedupimport - Fix duplicate imports that have the same import path but different import names.
  • gofmt - Gofmt formats Go programs. Must have for every project. Don't forget to use -s flag.
  • gofumpt - The tool is a modified fork of gofmt, enforcing a stricter format than gofmt, while being backwards compatible.
  • 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.
  • funlen - linter that checks for long functions. It can check both the number of lines and the number of statements.
  • 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

  • dogsled - Finds assignments/declarations with too many blank identifiers.
  • 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.
  • go-printf-func-name - checks that printf-like functions are named with f at the end.
  • go-ruleguard - Define and run pattern-based custom linting rules.
  • 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).
  • predeclared - Find code that shadows Go's built-in identifiers (e.g., append, copy, int).
  • 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.
  • whitespace - Checks for unnecessary newlines at the start and end of functions

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.
  • bodyclose - checks whether HTTP response body is closed and a re-use of TCP connection is not blocked
  • durcheck - durcheck is a very simple linter which detects potential bugs with time.Duration in a Go package.
  • enumcase - enumcase checks every switch statement handles all const values of the type.
  • 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.
  • gosumcheck - Checks all possible cases of type-switch are handled.
  • go-sumtype - Checks all possible cases of type-switch are handled.
  • 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.
  • sqlrows - checks whether Close on sql.Rows is called.
  • 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.
  • rangerdanger - Tool to detect range statements iterating over addressable arrays

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.
  • go-mnd - Magic number detector for Go.
  • gocheckit - A Go tool to help identify Deprecated Go Modules.

Linters Helper Tools

  • golangci-lint - Linters Runner for Go. 5x faster than gometalinter. Nice colored output. Can report only new issues. Fewer false-positives. Yaml/toml config.
  • gometalinter - 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.
  • golintui - A simple terminal UI for Go linters.