Favicon of golangci-lint

golangci-lint

golangci-lint is a fast Go linters runner that aggregates 100+ linters, runs them in parallel with caching, and integrates with CI and IDEs.

golangci-lint website screenshot
golangci-lint GitHub repository preview

golangci-lint is a linters runner for Go projects. Instead of installing and configuring dozens of individual linters (vet, staticcheck, errcheck, gosimple, and many more), you install one binary and one config file, and it runs the linters you enable against your codebase. It's built for Go developers and teams who want consistent static analysis in local dev, editors, and CI without stitching together separate tools.

The tool wraps over a hundred existing Go linters behind a single interface. It manages the complexity of running each linter's own binary or API, normalizes their output, and lets you turn linters on or off through configuration rather than shell scripts.

Key features

  • Parallel execution: runs enabled linters concurrently instead of sequentially, cutting down total lint time on multi-core machines.
  • Caching: caches analysis results so repeated runs on unchanged code are fast, useful for tight local dev and CI feedback loops.
  • YAML configuration: a single config file controls which linters run, their settings, exclusions, and file/path filters, replacing per-linter config sprawl.
  • Large linter catalog: bundles over 100 linters (style, bugs, performance, security, complexity) so you don't manage each one separately.
  • IDE integration: works with major Go IDEs and editors, surfacing lint issues inline during development.
  • CI-friendly design: built to run well in automated pipelines, with documented install paths specifically for CI/CD systems.
  • Docker image: an official image is published for teams that prefer running the linter in containers instead of installing binaries.

Ideal use cases

golangci-lint fits Go projects that want a repeatable, enforced code quality gate. Typical scenarios:

  • Pre-commit and pre-push checks: catch obvious bugs, unused code, and style issues before code review.
  • CI pipelines: fail builds on lint violations to keep quality consistent across contributors, especially in teams or open-source projects with many external PRs.
  • Editor feedback: get lint warnings while typing, via IDE integration, instead of waiting for CI.
  • Migrating from ad-hoc linting: if a project currently runs go vet plus a handful of separately installed linters via scripts, consolidating into golangci-lint simplifies maintenance.

It's not the right tool if you need a linter for a non-Go codebase, or if your project is small enough that a single linter (like go vet alone) is sufficient and the overhead of configuring a multi-linter setup isn't worth it. Teams that want deep custom static analysis rules beyond what the bundled linters expose may need to look at writing custom analyzers instead.

Installation

The README points to two install paths depending on where you run it:

  • Local machine: follow the instructions at the local install docs for your OS and package manager.
  • CI/CD systems: follow the CI install docs for setup in GitHub Actions, GitLab CI, or other pipelines.

A common approach across platforms is installing the binary via the official install script:

curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin

Once installed, run it from your project root:

golangci-lint run

A Docker image is also available if you prefer containerized execution:

docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint golangci-lint run

Full configuration options, linter lists, and CI-specific setup guides are documented at https://golangci-lint.run.

Frequently asked questions

Share:

Stars
19.4K
Forks
1.6K
Last commit
14 hours ago
Repository age
8 years
License
GPL-3.0
Self-hosted
No
Activity score
81/100
View Repository
Ad
Favicon

 

  
 

Similar to golangci-lint

Favicon

 

  
 
Favicon

 

  
 
Favicon