Skip to content

Commit fd09e47

Browse files
authored
Merge pull request moby#5295 from daghack/lint-check-print-error-source-map
frontend: add SourceInfoMap callback to LintResults.PrintErrorTo params
2 parents c958c68 + c075086 commit fd09e47

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

frontend/subrequests/lint/lint.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ func (results *LintResults) PrintTo(w io.Writer, scb SourceInfoMap) error {
180180
return nil
181181
}
182182

183-
func (results *LintResults) PrintErrorTo(w io.Writer) {
183+
func (results *LintResults) PrintErrorTo(w io.Writer, scb SourceInfoMap) {
184184
// This prints out the error in LintResults to the writer in a format that
185185
// is consistent with the warnings for easier downstream consumption.
186186
if results.Error == nil {
@@ -189,6 +189,9 @@ func (results *LintResults) PrintErrorTo(w io.Writer) {
189189

190190
fmt.Fprintln(w, results.Error.Message)
191191
sourceInfo := results.Sources[results.Error.Location.SourceIndex]
192+
if scb != nil {
193+
sourceInfo = scb(sourceInfo)
194+
}
192195
source := errdefs.Source{
193196
Info: sourceInfo,
194197
Ranges: results.Error.Location.Ranges,

0 commit comments

Comments
 (0)