add SourceInfoMap callback to LintResults.PrintErrorTo params

Signed-off-by: Talon Bowler <talon.bowler@docker.com>
This commit is contained in:
Talon Bowler committed 2024-09-04 02:20:19 -07:00
1 parent 94d3daefd5
commit c07508603c
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,