Linters
What is Revive? An introduction to mgechev's Go linter
Revive is a linter for Go that serves as a drop-in replacement for golint. It is fast, configurable and extensible, and it lets teams define their own rules. It targets Go developers and teams who want to improve their development and code review processes.
- Tool
- Revive
- Made by
- mgechev
- Official site
- github.com/mgechev/revive
- Category
- Linters
Who makes Revive
Revive is made by mgechev. The official website, which points to the project's GitHub repository, is linked below.
Official website: github.com/mgechev/revive
What Revive is for
Revive checks Go code against a set of linting rules and reports the results. It is designed to take the place of golint, so projects that relied on golint can move to a linter with a similar role.
Beyond the built-in rules, Revive provides a framework for developing custom rules and for defining a strict preset. This makes it suitable for teams that want their own conventions enforced automatically rather than relying only on a fixed rule list.
Who Revive is for
Revive is aimed at Go developers and at teams looking to enhance their development and code review processes. Automated lint results can take over routine style feedback so that reviewers can spend their attention elsewhere.
Because rules are configurable and extensible, it also suits teams that need to adapt linting to an existing codebase instead of accepting one fixed set of checks.
Notable capabilities
Revive combines configuration options, performance controls and several ways to run it. The main capabilities are listed below.
- Configuration through a TOML file, so linting rules can be set and kept alongside a project.
- Runs the same rules about twice as fast as golint.
- Rules, or the whole linter, can be disabled for a file or for a range of lines.
- Type checking is optional, and disabling the rules that do not need it speeds up runs.
- Multiple output formatters let users customize results, including a Checkstyle-compatible XML formatter.
- The return code can be customized for the whole linter or for specific rule failures.
- Can be run through Docker without a local installation.
- A framework for writing custom rules and defining a strict preset.
How Revive fits linters
Within the linters category, Revive is a Go-specific tool that focuses on rule-based checking of source code. Its configurable rules, custom rule framework and adjustable exit codes let it work as a gate in automated pipelines as well as a local check.
It also connects to the tools Go developers already use. It integrates with VSCode through vscode-go and is supported in GoLand through File Watchers. It can be enabled as a linter in golangci-lint, and MegaLinter runs it on Go projects in CI out of the box. For Linthelm's wider interest in linters, static analysis and code quality, Revive is a practical example of a linter that can be tuned and extended to a team's own standards.
Frequently asked questions
What is Revive used for?
Revive is used to lint Go code. It replaces golint and lets teams configure rules with a TOML file, write custom rules and define a strict preset.
Who develops Revive?
Revive is developed by mgechev. Its official website is the project's GitHub repository at https://github.com/mgechev/revive.
Is Revive faster than golint?
Revive runs the same rules about twice as fast as golint. Type checking is optional, and disabling rules that do not need it speeds up runs further.
Which editors and tools work with Revive?
Revive integrates with VSCode through vscode-go and is supported in GoLand through File Watchers. It can also be enabled in golangci-lint, and MegaLinter runs it on Go projects in CI.
Can Revive be run without installing it locally?
Yes. Revive can be run through Docker without a local installation.
Linthelm is independent and is not affiliated with mgechev. Product names belong to their owners. Features change; confirm details on the official website.