How golangci/golangci-lint works
golangci-lint is a Go static-analysis runner. Its principal workflow is: a user invokes the CLI, the run command loads configuration and selects linters, packages are analyzed, findings are processed, and configured output formats are printed. Separate capabilities include source formatting and configuration migration. The graph reflects README claims about parallel analysis, caching, YAML configuration, and the large linter catalog; connections for unsampled subsystems are omitted unless documented. The provided excerpts do not show every runtime call path.
Main entry points: run.go Run orchestration · commands Commands · runner_loadingpackage.go Package analysis · main.go CLI entry
Components 17
CLI and configuration
- CLI entry
cmd/golangci-lint/main.go - Commands
pkg/commands - Configuration
pkg/config
Analysis engine
- Run orchestration
pkg/commands/run.go - Linter catalog
pkg/lint/lintersdb/manager.go - Linter adapters
pkg/golinters - Analysis context
pkg/lint/context.go - Package analysis
pkg/goanalysis/runner_loadingpackage.go
Findings and output
- Issue model
pkg/result/issue.go - Issue processing
pkg/result/processors/processor.go - Automatic fixes
pkg/result/processors/fixer.go - Output printer
pkg/printers/printer.go
Formatting
- Format command
pkg/goformat/runner.go - Formatter registry
pkg/goformatters/meta_formatter.go
Caching and migration
- Analysis cache
internal/cache/cache.go - Config migration
pkg/commands/internal/migrate/migrate.go
Other components
- CLI user
Connections 18
- CLI user → CLI entry: invokes
cmd/golangci-lint/main.go - CLI entry → Commands: executes
cmd/golangci-lint/main.go - Commands → Run orchestration: runs analysis
- Commands → Format command: formats files
- Commands → Config migration: migrates config
- Run orchestration → Configuration: uses settings
pkg/commands/run.go - Run orchestration → Linter catalog: selects linters
pkg/commands/run.go - Linter catalog → Linter adapters: builds linters
- Run orchestration → Analysis context: builds context
pkg/commands/run.go - Analysis context → Package analysis: loads packages
- Run orchestration → Package analysis: runs analyzers
- Run orchestration → Analysis cache: uses cache
pkg/commands/run.go - Package analysis → Issue model: produces findings
- Run orchestration → Issue processing: processes findings
pkg/commands/run.go - Issue processing → Automatic fixes: applies fixes
- Run orchestration → Output printer: prints results
pkg/commands/run.go - Format command → Formatter registry: formats source
pkg/goformat/runner.go - Automatic fixes → Formatter registry: formats edits
pkg/result/processors/fixer.go