Merge pull request #5295 from daghack/lint-check-print-error-source-map

frontend: add SourceInfoMap callback to LintResults.PrintErrorTo params
This commit is contained in:
Tõnis Tiigi authored and GitHub committed 2024-09-04 09:52:47 -07:00
commit fd09e47bf7
1 file changed
+4 -1
+4 -1
View File
@@ -180,7 +180,7 @@ func (results *LintResults) PrintTo(w io.Writer, scb SourceInfoMap) error {
return nil
}
func (results *LintResults) PrintErrorTo(w io.Writer) {
func (results *LintResults) PrintErrorTo(w io.Writer, scb SourceInfoMap) {
// This prints out the error in LintResults to the writer in a format that
// is consistent with the warnings for easier downstream consumption.
if results.Error == nil {
@@ -189,6 +189,9 @@ func (results *LintResults) PrintErrorTo(w io.Writer) {
fmt.Fprintln(w, results.Error.Message)
sourceInfo := results.Sources[results.Error.Location.SourceIndex]
if scb != nil {
sourceInfo = scb(sourceInfo)
}
source := errdefs.Source{
Info: sourceInfo,
Ranges: results.Error.Location.Ranges,