revive-lint /revive
🔥 Fast, strict, configurable, extensible, and beautiful linter for Go
★ 5,569⑂ 339👁 32⑃ 1,370● 587▤ 47
+1
日增长
5,569
stars
339
forks
32
watchers
1,370
prs
587
issues
47
releases
README
revive
Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint.
Revive provides a framework for development of custom rules,
and lets you define a strict preset for enhancing your development & code review processes.
Logo by Georgi Serev
Here's how revive is different from golint:
- Allows to enable or disable rules using a configuration file.
- Allows to configure the linting rules with a TOML file.
- 2x faster running the same rules as golint.
- Provides functionality for disabling a specific rule or the entire linter for a file or a range of lines.
- golint allows this only for generated files.
- Optional type checking. Most rules in golint do not require type checking.
If you disable them in the config file, revive will run over 6x faster than golint.
- Provides multiple formatters which let us customize the output.
- Allows to customize the return code for the entire linter or based on the failure of only some rules.
- _Everyone can extend it easily with custom rules or formatters._
- Revive provides more rules compared to golint.
- Installation
- Homebrew
- Install from Sources
- Docker
- Manual Binary Download
- Usage
- Text Editors
- GitHub Actions
- Continuous Integration
- Linter aggregators
- golangci-lint
- MegaLinter
- Command Line Flags
- Sample Invocations
- Comment Directives
- Configuration
- Custom Configuration
- Recommended Configuration
- Rule-level file excludes
- Available Rules
- Configurable rules
- Available Formatters
- Friendly
- Stylish
- Default
- Plain
- Unix
- JSON
- NDJSON
- Checkstyle
- SARIF
- Extensibility
- Writing a Custom Rule
- Using revive as a library
- Custom Formatter
- Speed Comparison
- golint
- revive's speed
- Overriding colorization detection
- Who uses Revive
- Contributors
- Maintainers
- All
- License
Installation
revive is available inside the majority of package managers.
Homebrew
Install revive using brew:
bash
brew install revive
To upgrade to the latest version:
bash
brew upgrade revive
Install from Sources
Install the latest stable release directly from source:
bash
go install github.com/mgechev/revive@latest
To install the latest commit from the main branch:
bash
go install github.com/mgechev/revive@HEAD
Docker
You can run revive using Docker to avoid installing it directly on your system:
bash
docker run --rm -v "$(pwd)":/app -w /app ghcr.io/revive-lint/revive:latest -config /app/revive.toml -formatter stylish ./...
_Note_: images up to and including v1.16.0 are published at ghcr.io/mgechev/revive.
Later releases are published at ghcr.io/revive-lint/revive.
Manual Binary Download
Download the precompiled binary from the Releases page:
1. Select the appropriate binary for your OS and architecture.
2. Extract the binary and move it to a directory in your PATH (e.g., /usr/local/bin).
3. Verify installation:
bashTop issues
#1277Typed rules don't work as expected14 comments · 2025-03-19#680Different results when removing the GOCACHE and pkgs directories14 comments · 2022-04-10#1235exported: report differently a method that is now exported12 comments · 2025-02-12#1391Roadmap: Revive v2 major release11 comments · 2025-05-29#671Allow to ignoring "unhandled errors" by their type and method6 comments · 2022-04-07#1695empty-switch-cases: report empty switch cases5 comments · 2026-03-24#1662`redudant-import-alias` false positive5 comments · 2026-03-03#885Disabling a rule for a block without reenable5 comments · 2023-08-29
Latest release
v1.17.1 v1.17.1 2026-10-07What's Changed A patch release with fixes for rules that reused configuration across runs and for false positives/negatives. [!IMPORTANT] add-constant now inspects nested call arguments and function literal signatures (1843), so existing projects may see new findings after upgrading. Bug Fixes add-constant: inspect nested arguments by @dajiaohuang in https://github.com/revive-lint/revive/pull/1843 add-constant: reset configuration by @dajiaohuang in https://github.com/revive-lint/revive/pull/1839 banned-characters: reset configuration by @dajiaohuang in https://github.com/revive-lint/