From cc344dfbe396f60d15dfa289ee0cd6cd6843f5c4 Mon Sep 17 00:00:00 2001 From: besdollma <47672215+besdollma@users.noreply.github.com> Date: Fri, 8 Oct 2021 19:16:46 +0300 Subject: [PATCH] fix(cli): fix incorrect comparision of DB metadata type. (#1286) -- Incorrect Db metadata type comparision resulted in wrong print in show version. This fixes #1275. Signed-off-by: Bes Dollma --- pkg/commands/app.go | 4 ++-- pkg/commands/app_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/commands/app.go b/pkg/commands/app.go index 4492e03ea5..9c29b7b50e 100644 --- a/pkg/commands/app.go +++ b/pkg/commands/app.go @@ -410,9 +410,9 @@ func showVersion(cacheDir, outputFormat, version string, outputWriter io.Writer) if dbMeta != nil { var dbType string switch dbMeta.Type { - case 0: + case db.TypeFull: dbType = "Full" - case 1: + case db.TypeLight: dbType = "Light" } output += fmt.Sprintf(`Vulnerability DB: diff --git a/pkg/commands/app_test.go b/pkg/commands/app_test.go index 8a040f48b7..4ace3523c2 100644 --- a/pkg/commands/app_test.go +++ b/pkg/commands/app_test.go @@ -35,7 +35,7 @@ func Test_showVersion(t *testing.T) { }, expectedOutput: `Version: v1.2.3 Vulnerability DB: - Type: Light + Type: Full Version: 42 UpdatedAt: 2020-03-16 23:40:20 +0000 UTC NextUpdate: 2020-03-16 23:57:00 +0000 UTC