Skip to content

Commit 366328b

Browse files
committed
Add comment to document the purpose behind the non-standard handling of the error
Signed-off-by: Talon Bowler <[email protected]>
1 parent 927fb67 commit 366328b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

commands/build.go

+6
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,12 @@ func printResult(f *controllerapi.PrintFunc, res map[string]string) error {
878878
}
879879
}
880880
if lintResults.Error != nil {
881+
// Print the error message and the source
882+
// Normally, we would use `errdefs.WithSource` to attach the source to the
883+
// error and let the error be printed by the handling that's already in place,
884+
// but here we want to print the error in a way that's consistent with how
885+
// the lint warnings are printed via the `lint.PrintLintViolations` function,
886+
// which differs from the default error printing.
881887
fmt.Println()
882888
lintBuf := bytes.NewBuffer([]byte(lintResults.Error.Message + "\n"))
883889
sourceInfo := lintResults.Sources[lintResults.Error.Location.SourceIndex]

0 commit comments

Comments
 (0)