Package checker defines the implementation of the checker commands. The same code drives the multi-analysis driver, the single-analysis driver that is conventionally provided for convenience along with each analysis package, and the test driver.
var ( // Debug is a set of single-letter flags: // // f show [f]acts as they are created // p disable [p]arallel execution of analyzers // s do additional [s]anity checks on fact types and serialization // t show [t]iming info (NB: use 'p' flag to avoid GC/scheduler noise) // v show [v]erbose logging // Debug = "" // Log files for optional performance tracing. CPUProfile, MemProfile, Trace string )
RegisterFlags registers command-line flags used by the analysis driver.
Run loads the packages specified by args using go/packages, then applies the specified analyzers to them. Analysis flags must already have been set. It provides most of the logic for the main functions of both the singlechecker and the multi-analysis commands. It returns the appropriate exit code.
TestAnalyzer applies an analysis to a set of packages (and their dependencies if necessary) and returns the results.
Facts about pkg are returned in a map keyed by object; package facts have a nil key.
This entry point is used only by analysistest.