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/unitchecker: export output JSON schema and include SuggestedFixes #55138

Closed
lfolger opened this issue Sep 19, 2022 · 3 comments
Labels
Analysis Issues related to static analysis (vet, x/tools/go/analysis) FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@lfolger
Copy link
Contributor

lfolger commented Sep 19, 2022

Currently the unitchecker offers a JSON (via the -json flag).

The schema of the JSON output is not documented and the output does not contain SuggestedFixes. I propose to document the schema and include SuggestedFixes in the output. I think it is reasonable to export the position information as filename and byte offsets for start and end into the file. The end is exclusive (similar to the AST representation).

The implementation for the JSON output is here. Exporting and extending it should solve this issue.

I have not yet checked in detail if this is used by other code as well.
It might make sense to flag protect the new output to not break existing tools that rely on the output without SuggestedFixes.

@lfolger lfolger added Tools This label describes issues relating to any tools in the x/tools repository. Analysis Issues related to static analysis (vet, x/tools/go/analysis) labels Sep 19, 2022
@gopherbot gopherbot added this to the Unreleased milestone Sep 19, 2022
@cherrymui cherrymui added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Sep 19, 2022
@cherrymui
Copy link
Member

cc @timothy-king @zpavlinovic

@timothy-king
Copy link
Contributor

Including SuggestedFixes in json output seems like a good idea to me.

If possible it would be preferable to not add another flag, but we should do at least a preliminary investigations of tools that use -json to confirm whether these are backwards compatible. Based on what the investigation finds, we can choose whether we can safely add a flag or not.

@gopherbot
Copy link

Change https://go.dev/cl/435255 mentions this issue: x/tools/go/analysis: extend json output by SuggestedFixes

@dmitshur dmitshur added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. labels Sep 30, 2022
@golang golang locked and limited conversation to collaborators Sep 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Analysis Issues related to static analysis (vet, x/tools/go/analysis) FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

5 participants