Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add message when --check does not produce warnings or errors #2549

Merged
merged 1 commit into from
Jun 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion commands/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -885,14 +885,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