How mgechev/revive works
Revive is a configurable Go source-code linter and extensible linting library. Its main workflow is: a user invokes the CLI with paths and options; configuration selects and configures rules and an output formatter; the runner discovers packages and delegates file analysis to the linter; rules report failures; and the selected formatter renders them for the user. The README also documents comment-based suppression, optional type checking, custom rules and formatters, and configurable exit codes. Some of those implementation details are unsampled, so documented links are shown without implying uninspected internals.
Main entry points: core.go Lint runner · rule Rule implementations · main.go Command-line app · file.go File analysis
Components 23
CLI and runner
- Command-line app
cli/main.go - Lint runner
revivelib/core.go - Include/exclude patterns
revivelib/pattern.go
Configuration
- Config and registry
config/config.go - Lint settings
lint/config.go
Lint analysis
- Package analysis
lint/package.go - File analysis
lint/file.go - File suppression
lint/filefilter.go - Rule interface
lint/rule.go - Rule implementations
rule - Exported naming
rule/exported.go - Package naming
rule/package_naming.go - Struct tag checks
rule/struct_tag.go - Time/date checks
rule/time_date.go
Results and extensions
- Lint failures
lint/failure.go - Formatter registry
config/config.go - Output formatters
formatter - Friendly formatter
formatter/friendly.go - SARIF formatter
formatter/sarif.go - Custom rule support
revivelib/extra_rule.go
Other components
- Go developer
- Go project
- Rendered findings
Connections 29
- Go developer → Command-line app: invokes
README.md - Go project → Command-line app: selects paths
README.md - Command-line app → Config and registry: loads config
cli/main.go - Command-line app → Lint runner: starts lint
cli/main.go - Command-line app → Include/exclude patterns: builds patterns
cli/main.go - Lint runner → Config and registry: uses config
revivelib/core.go - Config and registry → Lint settings: configures
config/config.go - Config and registry → Rule implementations: registers rules
config/config.go - Lint runner → Package analysis: runs analysis
revivelib/core.go - Package analysis → File analysis: lints files
lint/package.go - File analysis → Rule interface: applies rules
- Rule interface → Rule implementations: implemented by
- Rule implementations → Exported naming: includes
- Rule implementations → Package naming: includes
- Rule implementations → Struct tag checks: includes
- Rule implementations → Time/date checks: includes
- File analysis → Lint failures: reports
- Lint runner → Formatter registry: selects formatter
revivelib/core.go - Formatter registry → Output formatters: registers formats
config/config.go - Output formatters → Friendly formatter: includes
- Output formatters → SARIF formatter: includes
- Lint runner → Lint failures: forwards failures
revivelib/core.go - Lint failures → Output formatters: formatted by
- Lint runner → Rendered findings: returns output
revivelib/core.go - Go developer → Custom rule support: extends linter
README.md - File analysis → File suppression: honors suppression
README.md - Package analysis → Go project: analyzes packages
- Friendly formatter → Rendered findings: renders findings
formatter/friendly.go - SARIF formatter → Rendered findings: renders findings
formatter/sarif.go