Skip to content

Commit

Permalink
Merge pull request #5295 from daghack/lint-check-print-error-source-map
Browse files Browse the repository at this point in the history
frontend: add SourceInfoMap callback to LintResults.PrintErrorTo params
  • Loading branch information
tonistiigi authored Sep 4, 2024
2 parents c958c68 + c075086 commit fd09e47
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion frontend/subrequests/lint/lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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,
Expand Down

0 comments on commit fd09e47

Please sign in to comment.