NilAway Architecture Overview
mainNilAway is composed of multiple sub-analyzers that implement the analysis.Analyzer interface. These analyzers are connected via dependencies (using the Requires field).
Core Components:
- Triggers: Flow conditions that may cause nil panics.
- Annotations: Metadata about nilability of types and functions.
- Inference Engine: Matches triggers with annotations to detect nil flows.
- Facts Mechanism: Caches analysis results across packages for performance.
Analyzer Hierarchy:
nilaway.Analyzer: The top-level analyzer that reports errors.accumulation.Analyzer: Collects triggers and runs inference.annotation.Analyzer: Reads annotations.function.Analyzer: Analyzes functions and creates triggers.affiliation.Analyzer: Creates interface-struct affiliation triggers.global.Analyzer: Creates global variable triggers
All analyzers depend on config.Analyzer to retrieve configurations.