type Config … // Main is the main function of a vet-like analysis tool that must be // invoked by a build system to analyze a single package. // // The protocol required by 'go vet -vettool=...' is that the tool must support: // // -flags describe flags in JSON // -V=full describe executable for build caching // foo.cfg perform separate modular analyze on the single // unit described by a JSON config file foo.cfg. func Main(analyzers ...*analysis.Analyzer) { … } // Run reads the *.cfg file, runs the analysis, // and calls os.Exit with an appropriate error code. // It assumes flags have already been set. func Run(configFile string, analyzers []*analysis.Analyzer) { … } func readConfig(filename string) (*Config, error) { … } type factImporter … var makeTypesImporter … var exportTypes … var makeFactImporter … var exportFacts … func run(fset *token.FileSet, cfg *Config, analyzers []*analysis.Analyzer) ([]result, error) { … } type result … type importerFunc … func (f importerFunc) Import(path string) (*types.Package, error) { … }