Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/go/analysis: accomodate multiple output formats in Diagnostic #32156

Closed
dominikh opened this issue May 21, 2019 · 4 comments
Closed

x/tools/go/analysis: accomodate multiple output formats in Diagnostic #32156

dominikh opened this issue May 21, 2019 · 4 comments
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@dominikh
Copy link
Member

Right now, analyses report diagnostics, where a diagnostic consists of a position, category and message. This makes it difficult to accommodate multiple output formats. For editor integration, we want short, concise messages. These messages are usually restricted to one line, but may be occasionally multi-line. For interactive use in a terminal, we may want to offer a more verbose format that includes instructions on how to address the finding, or provide more information about the context of the finding. For interactive use in a browser, we would like to include hyperlinks, or possibly other markup. It is not feasible to address all these different media with a single message.

I am not proposing a concrete solution to the problem. Instead, I'd like to encourage discussion on how we can improve the situation.

/cc @matloob @ianthehat @mvdan @fatih

@dominikh dominikh added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label May 21, 2019
@dominikh dominikh added this to the Unreleased milestone May 21, 2019
@matloob
Copy link
Contributor

matloob commented Jun 19, 2019

I agree that this is a bit of a problem. I think the solution might be to have conventions on how the messages are displayed. Maybe we only show the first sentence/line in some cases?

One thing I'd worry about if we added multiple message fields is that we might add too many output formats so that we don't make writing the docs too burdensome on tool writers...

@ianthehat
Copy link

I think we might be better off indicating to the analysis the type of output we want and then sticking to a single string.

@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Sep 12, 2019
@dominikh
Copy link
Member Author

dominikh commented May 3, 2020

Diagnostics now have suggested fixes and related information, which covers most needs expressed in this issue. The only issue that remains is differently formatted messages for different frontends. Personally I think this can be worked around with what we have.

Tools that want to display a short message can display the first paragraph, tools that want to display more detailed messages can display the whole message. This would work similar to git log and git log --oneline.

Hyperlinks don't need explicit markup, they can be automatically extracted from text if written out as URLs. And nobody has asked for more complex formatting.

I am going to close this issue, but feel free to reopen if you disagree with my conclusion.

@dominikh dominikh closed this as completed May 3, 2020
@matloob
Copy link
Contributor

matloob commented May 4, 2020

Sounds good

@golang golang locked and limited conversation to collaborators May 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

4 participants