Closed
Description
Currently there is no driver suitable for running analyzers from a go test (or from code, in general). The multichecker and singlechecker drivers are meant for cli tools and call os.Exit(), so they cannot be used.
We want to be able to run analysis from a go test rather than a separate binary. It is easier to integrate into our CI system if is a normal test.
My first thought was something that looks like this:
func Run(args []string, analyzers []*analysis.Analyzer) ([]analysis.Diagnostic, error)
Returning Diagnostic is not quite right though since the user doesn't have the FileSet to translate the diagnostics' token.Pos. I also assume something would have to be done for passing analyzer flags programatically.
/cc @ianthehat since you responded briefly in Slack regarding this feature request