-
Notifications
You must be signed in to change notification settings - Fork 66
Architecture
For best performance and easier maintenance, NilAway consists of multiple levels of sub-analyzers that are all
analysis.Analyzer
s, and they are connected by specifying dependencies (via Requires
field) between them. Currently, the organization is as follows:
-
nilaway.Analyzer
in nilaway.go
All the analyzers depend on config.Analyzer
(config/config.go
) to retrieve configurations.
The decoupling of error generation and error reporting logic makes it possible to apply custom error reporting to fit other needs. For example, it is possible to create another top-level analyzer nilaway-log
that depends on the accumulation analyzer, which simply retrieves the NilAway errors and logs them to a local file or database for later auditing.
This is the top-level analyzer that simply reports the errors via analysis.Pass.Report
.
This analyzer collects the triggers from sub-analyzers, runs the inference algorithm, and returns the errors for higher-level analyzers.
This analyzer analyzes each function and creates triggers for it.
This analyzer collects auxiliary information about function literals and reports to function analyzer.
This analyzer collects auxiliary information about struct field accesses and reports to function analyzer.
This analyzer creates triggers about interface-struct affiliations.
This analyzer creates triggers about global variables.
This analyzer does nothing but takes the Flags
and makes the flags available for other sub-analyzers.