From 230480c89604dac471233326d383077451c95875 Mon Sep 17 00:00:00 2001 From: Zvonimir Pavlinovic Date: Fri, 19 Apr 2024 13:38:23 +0000 Subject: [PATCH] internal/vulncheck: improve progress message for binaries Change-Id: Ib5b4b335e44d3ca3e72f4772b7e03fca615e7ae7 Reviewed-on: https://go-review.googlesource.com/c/vuln/+/580158 Auto-Submit: Zvonimir Pavlinovic Reviewed-by: Maceo Thompson Run-TryBot: Zvonimir Pavlinovic LUCI-TryBot-Result: Go LUCI TryBot-Result: Gopher Robot --- .../common/testfiles/binary-call/binary_call_json.ct | 2 +- .../common/testfiles/binary-call/binary_vendored_json.ct | 2 +- .../common/testfiles/binary-module/binary_module_json.ct | 2 +- .../common/testfiles/binary-package/binary_package_json.ct | 2 +- internal/vulncheck/binary.go | 2 +- internal/vulncheck/source.go | 2 +- internal/vulncheck/vulncheck.go | 5 +++-- 7 files changed, 9 insertions(+), 8 deletions(-) diff --git a/cmd/govulncheck/testdata/common/testfiles/binary-call/binary_call_json.ct b/cmd/govulncheck/testdata/common/testfiles/binary-call/binary_call_json.ct index b48f5744..2fd22403 100644 --- a/cmd/govulncheck/testdata/common/testfiles/binary-call/binary_call_json.ct +++ b/cmd/govulncheck/testdata/common/testfiles/binary-call/binary_call_json.ct @@ -24,7 +24,7 @@ $ govulncheck -format json -mode binary ${common_vuln_binary} } { "progress": { - "message": "Checking the code against the vulnerabilities..." + "message": "Checking the binary against the vulnerabilities..." } } { diff --git a/cmd/govulncheck/testdata/common/testfiles/binary-call/binary_vendored_json.ct b/cmd/govulncheck/testdata/common/testfiles/binary-call/binary_vendored_json.ct index 94a8669c..30f1556e 100644 --- a/cmd/govulncheck/testdata/common/testfiles/binary-call/binary_vendored_json.ct +++ b/cmd/govulncheck/testdata/common/testfiles/binary-call/binary_vendored_json.ct @@ -24,7 +24,7 @@ $ govulncheck -format json -mode binary ${common_vendored_binary} } { "progress": { - "message": "Checking the code against the vulnerabilities..." + "message": "Checking the binary against the vulnerabilities..." } } { diff --git a/cmd/govulncheck/testdata/common/testfiles/binary-module/binary_module_json.ct b/cmd/govulncheck/testdata/common/testfiles/binary-module/binary_module_json.ct index 7eb8029f..c94989df 100644 --- a/cmd/govulncheck/testdata/common/testfiles/binary-module/binary_module_json.ct +++ b/cmd/govulncheck/testdata/common/testfiles/binary-module/binary_module_json.ct @@ -24,7 +24,7 @@ $ govulncheck -format json -mode binary -scan module ${common_vuln_binary} } { "progress": { - "message": "Checking the code against the vulnerabilities..." + "message": "Checking the binary against the vulnerabilities..." } } { diff --git a/cmd/govulncheck/testdata/common/testfiles/binary-package/binary_package_json.ct b/cmd/govulncheck/testdata/common/testfiles/binary-package/binary_package_json.ct index 43e08c48..9d81fd6e 100644 --- a/cmd/govulncheck/testdata/common/testfiles/binary-package/binary_package_json.ct +++ b/cmd/govulncheck/testdata/common/testfiles/binary-package/binary_package_json.ct @@ -24,7 +24,7 @@ $ govulncheck -format json -mode binary -scan package ${common_vuln_binary} } { "progress": { - "message": "Checking the code against the vulnerabilities..." + "message": "Checking the binary against the vulnerabilities..." } } { diff --git a/internal/vulncheck/binary.go b/internal/vulncheck/binary.go index dbe89756..243dfb52 100644 --- a/internal/vulncheck/binary.go +++ b/internal/vulncheck/binary.go @@ -63,7 +63,7 @@ func binary(ctx context.Context, handler govulncheck.Handler, bin *Bin, cfg *gov return nil, err } - if err := handler.Progress(&govulncheck.Progress{Message: checkingVulnsMessage}); err != nil { + if err := handler.Progress(&govulncheck.Progress{Message: checkingBinVulnsMessage}); err != nil { return nil, err } diff --git a/internal/vulncheck/source.go b/internal/vulncheck/source.go index e0087176..47545008 100644 --- a/internal/vulncheck/source.go +++ b/internal/vulncheck/source.go @@ -71,7 +71,7 @@ func source(ctx context.Context, handler govulncheck.Handler, cfg *govulncheck.C return nil, err } - if err := handler.Progress(&govulncheck.Progress{Message: checkingVulnsMessage}); err != nil { + if err := handler.Progress(&govulncheck.Progress{Message: checkingSrcVulnsMessage}); err != nil { return nil, err } diff --git a/internal/vulncheck/vulncheck.go b/internal/vulncheck/vulncheck.go index ac61087a..3c4cabfe 100644 --- a/internal/vulncheck/vulncheck.go +++ b/internal/vulncheck/vulncheck.go @@ -17,8 +17,9 @@ import ( ) const ( - fetchingVulnsMessage = "Fetching vulnerabilities from the database..." - checkingVulnsMessage = "Checking the code against the vulnerabilities..." + fetchingVulnsMessage = "Fetching vulnerabilities from the database..." + checkingSrcVulnsMessage = "Checking the code against the vulnerabilities..." + checkingBinVulnsMessage = "Checking the binary against the vulnerabilities..." ) // Result contains information on detected vulnerabilities.