Merge pull request #2549 from daghack/warning-free-msg

Add message when --check does not produce warnings or errors
This commit is contained in:
Tõnis Tiigi 2024-06-28 16:45:57 -07:00 committed by GitHub
commit 2b17f277a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 1 deletions

View File

@ -893,7 +893,10 @@ 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,
@ -901,6 +904,8 @@ func printResult(f *controllerapi.PrintFunc, res map[string]string) error {
}
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" {