Revive: An extensible and configurable linter for Go
No need for extensive deduction to find out where that source code error came from! Solve all your bugs and suspicious constructs with Revive, a fast and configurable linter for Go.
Revive is a fast and configurable linter for Go, providing a framework to develop custom rules. This framework makes it possible for developers to define a specific and custom preset for enhancing their process for development and code review.
While Go already comes with a preexisting linter in
golint, Revive offers developers more options for custom control and configuration to make the entire development process easier and faster.
Go is an opinionated language, so it’s no surprise that
golint is too. As such,
golint isn’t extensible, nor can developers include or exclude specific rules. Plus, failures have a level of confidence in
golint, even if they are false negatives.
Revive is a drop-in replacement for golint with a whole bunch of new features and performance enhancements. It’s got all the same great deduction capabilities, but with even more options for developers.
Revive promises that everyone can extend the framework easily with their own custom rules or formatters. It does so by making it possible to pick and choose which rules the linter should follow. Developers can do that by enabling or disabling rules via a configuration file or TOML file. Plus, it provides multiple formatters to customize the output.
Type checking is also optional, since most rules in
golint don’t really need type checking, but it does so anyways. So, if type checking is disabled, Revive runs 6x faster than
golint. Compared to
golint, Revive performs better because it lints the files for each individual rule into a separate goroutine.
SEE ALSO: Top 5 libraries for Go
Where to get Revive
Revive is open for external contributions and it’s one of the easiest ways to add new rules into the project.