-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
AnalysisIssues related to static analysis (vet, x/tools/go/analysis)Issues related to static analysis (vet, x/tools/go/analysis)NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.ToolsThis label describes issues relating to any tools in the x/tools repository.This label describes issues relating to any tools in the x/tools repository.
Milestone
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
mikesep, ronnylt, bflad and IceflowRE
Metadata
Metadata
Assignees
Labels
AnalysisIssues related to static analysis (vet, x/tools/go/analysis)Issues related to static analysis (vet, x/tools/go/analysis)NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.ToolsThis label describes issues relating to any tools in the x/tools repository.This label describes issues relating to any tools in the x/tools repository.