Skip to content

x/tools/go/analysis: change RelatedInformation to work without fileset #54233

Open
@hyangah

Description

@hyangah

RelatedInformation is used to add information related to a diagnostic. Currently it is defined as:

type RelatedInformation struct {
	Pos     token.Pos
	End     token.Pos
	Message string
}

I believe this corresponds to LSP's DiagnosticRelatedInformation and the Pos/End would be translated to LSP Location.

The use of token.Pos in RelatedInformation implies we need to depend on a certain token.FileSet. If the positions of the related information belong to the same package, that's fine. Otherwise, it is awkward to use. For example, I hoped I could annotate reports on functions that transitively call known vulnerable symbols. But the vulnerable symbols may be in different package and we learned about it from Facts generated by the analyzer run on the package.

Will Position be too inefficient?

cc @adonovan @timothy-king

Metadata

Metadata

Assignees

No one assigned

    Labels

    AnalysisIssues 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.ToolsThis label describes issues relating to any tools in the x/tools repository.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions