Skip to content

Commit

Permalink
Merge pull request #2549 from daghack/warning-free-msg
Browse files Browse the repository at this point in the history
Add message when --check does not produce warnings or errors
  • Loading branch information
tonistiigi authored Jun 28, 2024
2 parents ea7c8e8 + b6482ab commit 2b17f27
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion commands/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -893,14 +893,19 @@ func printResult(f *controllerapi.PrintFunc, res map[string]string) error {
// 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"))
lintBuf := bytes.NewBuffer([]byte(lintResults.Error.Message))
if f.Format != "json" {
fmt.Fprintln(lintBuf)
}
sourceInfo := lintResults.Sources[lintResults.Error.Location.SourceIndex]
source := errdefs.Source{
Info: sourceInfo,
Ranges: lintResults.Error.Location.Ranges,
}
source.Print(lintBuf)
return errors.New(lintBuf.String())
} else if len(lintResults.Warnings) == 0 && f.Format != "json" {
fmt.Println("Check complete, no warnings found.")
}
default:
if dt, ok := res["result.json"]; ok && f.Format == "json" {
Expand Down

0 comments on commit 2b17f27

Please sign in to comment.