mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-05-18 09:17:49 +08:00
Add message when --check does not produce warnings or errors
Signed-off-by: Talon Bowler <talon.bowler@docker.com>
This commit is contained in:
parent
7b1ec7211d
commit
b6482ab6bb
@ -885,7 +885,10 @@ func printResult(f *controllerapi.PrintFunc, res map[string]string) error {
|
|||||||
// the lint warnings are printed via the `lint.PrintLintViolations` function,
|
// the lint warnings are printed via the `lint.PrintLintViolations` function,
|
||||||
// which differs from the default error printing.
|
// which differs from the default error printing.
|
||||||
fmt.Println()
|
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]
|
sourceInfo := lintResults.Sources[lintResults.Error.Location.SourceIndex]
|
||||||
source := errdefs.Source{
|
source := errdefs.Source{
|
||||||
Info: sourceInfo,
|
Info: sourceInfo,
|
||||||
@ -893,6 +896,8 @@ func printResult(f *controllerapi.PrintFunc, res map[string]string) error {
|
|||||||
}
|
}
|
||||||
source.Print(lintBuf)
|
source.Print(lintBuf)
|
||||||
return errors.New(lintBuf.String())
|
return errors.New(lintBuf.String())
|
||||||
|
} else if len(lintResults.Warnings) == 0 && f.Format != "json" {
|
||||||
|
fmt.Println("Check complete, no warnings found.")
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
if dt, ok := res["result.json"]; ok && f.Format == "json" {
|
if dt, ok := res["result.json"]; ok && f.Format == "json" {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user