Repository navigation
fix: print diagnostics in source order with the lines of a var file - #69
Merged
Merged
Conversation
… its diagnostics.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two problems made diagnostics harder to read:
format --validateandupprinted several errors in a different order from run to run. The decoder walks a map, and Go randomises the order of a map.--var-fileshowed "(source code not available)" in place of the line, because the diagnostics writer knew only the source of the profile.Fixes
DiagnosticsManager.Writesorts the diagnostics before it writes them. First come those without a place, then those of the profile, then those of each other file by name. Each file goes from top to bottom. The sort is stable, so two diagnostics at the same place keep their order.Writereads the source of each regular file that a diagnostic points into and that the writer does not know yet, for example a--var-file. The writer and the manager share the map of sources, so the writer shows the line.Writenever reads a pipe, because a second read of--var-file <(...)can block.format --validateshows its warnings throughReport, not through the writer directly, so warnings are sorted too.