x/tools/go/analysis: support and encourage use of RelatedInformation for multi-part errors #66678
Labels
Analysis
Issues related to static analysis (vet, x/tools/go/analysis)
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
Let's explore the potential for greater use of analysis.RelatedInformation for richer and more easily understandable diagnostics.
From Google Issue 332766358:
We have the API for it already (analysis.RelatedInformation) but none of our analyzers populate this field because no drivers display it. Actually that's not quite true: gopls passes it directly to the RelatedInformation field in LSP), and then it's up to the client editor to display it however it wants. Of course I don't know what this looks like in practice because none of our analyzers populate it. :) It would be an interesting exercise to see what it looks like in popular editors, and inspect our existing analyzers for opportunities to use this feature to clarify their responses. (Off the top of my head, the lostcancel analyzer always reports an error that relates two source locations, so it would be a good candidate.) Then we would know whether it is worth adding/borrowing/stealing a fancy ASCII-art frontend for the CLI-based drivers. But if some clients just discard this information, there's a disincentive to adapt any analyzer to populate it---a chicken-and-egg situation.
Related:
RelatedInformation
to work without fileset #54233The text was updated successfully, but these errors were encountered: