From 7b1564a6a18c6bbb402fc5b6e3fb4143d6e42ca8 Mon Sep 17 00:00:00 2001 From: Jess Frazelle Date: Mon, 24 Sep 2018 23:03:13 -0400 Subject: [PATCH] update Signed-off-by: Jess Frazelle --- vulns.go | 5 +++++ vulns_test.go | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/vulns.go b/vulns.go index 27a59be8..b9e89e4b 100644 --- a/vulns.go +++ b/vulns.go @@ -87,6 +87,11 @@ func (cmd *vulnsCommand) Run(ctx context.Context, args []string) error { } } + if len(report.VulnsBySeverity) < 1 { + fmt.Println("No vulnerabilies found.") + return nil + } + // Print summary and count. for sev, vulns := range report.VulnsBySeverity { fmt.Printf("%s: %d\n", sev, len(vulns)) diff --git a/vulns_test.go b/vulns_test.go index 22b1c6de..e4c92276 100644 --- a/vulns_test.go +++ b/vulns_test.go @@ -12,7 +12,8 @@ func TestVulns(t *testing.T) { t.Fatalf("output: %s, error: %v", out, err) } - expected := `clair.clair resp.Status=200 OK` + expected := `clair.clair resp.Status=200 OK +No vulnerabilies found.` if !strings.HasSuffix(strings.TrimSpace(out), expected) { t.Fatalf("expected: %s\ngot: %s", expected, out) }