Repolode
revive-lint

revive-lint/revive

A fast, configurable Go linter that drops in for golint and supports custom rules and output formatters.

Stars
5,564
Forks
341
Open issues
89
Last commit
4 days ago

What is it?

revive is a linter for Go source code. It runs the same checks as golint by default, so it can be used as a drop-in replacement, and it adds a large set of additional rules that can be turned on or off through a TOML configuration file. Individual rules can also be configured with arguments, such as a maximum function length or cyclomatic complexity threshold.

Compared with golint, revive lets you disable rules or the whole linter for a single file or range of lines using comment directives, choose among several output formats (default, JSON, NDJSON, stylish, friendly, checkstyle, SARIF), and customize the exit code per rule severity. Type checking is optional, and skipping it for rules that do not need it speeds up runs.

revive is also designed to be extended. Developers can write custom rules and formatters, and it can be used as a Go library. It integrates with editors such as VS Code, GoLand and vim, and with CI tools including golangci-lint and MegaLinter.

Key features

  • 01Drop-in replacement for golint with compatible default behavior.
  • 02Enable, disable and configure individual rules through a TOML file.
  • 03Disable rules or the linter per file, line range or line with comment directives.
  • 04Multiple output formats including JSON, checkstyle and SARIF.
  • 05Supports custom rules and formatters for extension.

Use cases

  • Enforcing a stricter, team-wide Go style and code review standard.
  • Running Go lint checks in CI pipelines with machine-readable output.
  • Replacing golint in existing projects to gain speed and more rules.
  • Writing project-specific lint rules for internal conventions.

Quick start

  1. 1

    Install revive with Homebrew

    brew install revive
  2. 2

    Or install the latest release from source with Go

    go install github.com/mgechev/revive@latest
  3. 3

    Verify the installation

    revive -version

Things to know

  • Without a config file, revive only runs the golint-compatible default rules unless enable-default-rules or a config is set.

In collections

Topics

FAQ

What is revive?
A fast, configurable Go linter that drops in for golint and supports custom rules and output formatters. revive is a linter for Go source code. It runs the same checks as golint by default, so it can be used as a drop-in replacement, and it adds a large set of additional rules that can be turned on or off through a TOML configuration file. Individual rules can also be configured with arguments, such as a maximum function length or cyclomatic complexity threshold.
Is revive free to use? What license does it have?
revive is open source under the MIT license. Check the license terms before using it in commercial products.
Is revive still maintained?
Actively maintained. The last commit to revive was on Nov 3, 2026.
What can I use revive for?
Enforcing a stricter, team-wide Go style and code review standard. Running Go lint checks in CI pipelines with machine-readable output. Replacing golint in existing projects to gain speed and more rules. Writing project-specific lint rules for internal conventions.
How do I install revive?
Install revive with Homebrew: brew install revive Or install the latest release from source with Go: go install github.com/mgechev/revive@latest Verify the installation: revive -version
Where can I get revive?
The source code and installation instructions are on GitHub: https://github.com/revive-lint/revive

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects