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 <besi7dollma@gmail.com>
This commit is contained in:
besdollma
2021-10-08 19:16:46 +03:00
committed by GitHub
parent 0dec17fc3f
commit cc344dfbe3
2 changed files with 3 additions and 3 deletions

View File

@@ -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:

View File

@@ -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