Skip to content

Commit

Permalink
Add comment to document the purpose behind the non-standard handling …
Browse files Browse the repository at this point in the history
…of the error

Signed-off-by: Talon Bowler <talon.bowler@docker.com>
(cherry picked from commit 366328b)
  • Loading branch information
daghack authored and tonistiigi committed Jun 18, 2024
1 parent fe728e7 commit 18fb636
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions commands/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,12 @@ func printResult(f *controllerapi.PrintFunc, res map[string]string) error {
}
}
if lintResults.Error != nil {
// Print the error message and the source
// Normally, we would use `errdefs.WithSource` to attach the source to the
// error and let the error be printed by the handling that's already in place,
// but here we want to print the error in a way that's consistent with how
// the lint warnings are printed via the `lint.PrintLintViolations` function,
// which differs from the default error printing.
fmt.Println()
lintBuf := bytes.NewBuffer([]byte(lintResults.Error.Message + "\n"))
sourceInfo := lintResults.Sources[lintResults.Error.Location.SourceIndex]
Expand Down

0 comments on commit 18fb636

Please sign in to comment.