From 55ea0231650d8a934f4f33bd60f16b986e972468 Mon Sep 17 00:00:00 2001 From: Oliver Chang Date: Wed, 1 Feb 2023 16:58:10 +1100 Subject: [PATCH] Log number of packages scanned from SBOMs. (#179) --- pkg/osvscanner/osvscanner.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/osvscanner/osvscanner.go b/pkg/osvscanner/osvscanner.go index 4afbb33c94..fa2990ffdd 100644 --- a/pkg/osvscanner/osvscanner.go +++ b/pkg/osvscanner/osvscanner.go @@ -125,6 +125,7 @@ func scanSBOMFile(r *output.Reporter, query *osv.BatchedQuery, path string) erro // Skip if this isn't the case to avoid panics continue } + count := 0 err := provider.GetPackages(file, func(id sbom.Identifier) error { purlQuery := osv.MakePURLRequest(id.PURL) purlQuery.Source = models.SourceInfo{ @@ -132,12 +133,13 @@ func scanSBOMFile(r *output.Reporter, query *osv.BatchedQuery, path string) erro Type: "sbom", } query.Queries = append(query.Queries, purlQuery) + count++ return nil }) if err == nil { // Found the right format. - r.PrintText(fmt.Sprintf("Scanned %s SBOM\n", provider.Name())) + r.PrintText(fmt.Sprintf("Scanned %s SBOM and found %d packages\n", provider.Name(), count)) return nil }