From c07508603c1dcc9b14ae2f73beef3c7efd094cab Mon Sep 17 00:00:00 2001 From: Talon Bowler Date: Wed, 4 Sep 2024 02:20:19 -0700 Subject: [PATCH] add SourceInfoMap callback to LintResults.PrintErrorTo params Signed-off-by: Talon Bowler --- frontend/subrequests/lint/lint.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/subrequests/lint/lint.go b/frontend/subrequests/lint/lint.go index 3b6b444fd..8891f59dd 100644 --- a/frontend/subrequests/lint/lint.go +++ b/frontend/subrequests/lint/lint.go @@ -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,