add stringer support to match object

This commit is contained in:
Alex Goodman 2020-06-01 07:16:01 -04:00
parent 90074788d7
commit 27cb2cab5a
No known key found for this signature in database
GPG key ID: 86E2870463D5E890

View file

@ -1,17 +1,21 @@
package match
import (
"fmt"
"github.com/anchore/imgbom/imgbom/pkg"
"github.com/anchore/vulnscan-db/pkg/vulnerability"
"github.com/anchore/vulnscan/vulnscan/vulnerability"
)
type Match struct {
Confidence float64
Vulnerability vulnerability.Vulnerability
Package pkg.Package // is this needed? Or should we just capture the package ID (which is not stable between runs)?
SearchKey string // what made this a hit? CPE, package-name-version, etc... we need to capture how this was matched (TODO)
Package *pkg.Package
// SearchKey provides an indication of how this match was found.
// TODO: enhance this to be a rich object
SearchKey string
}
// TODO: delete me... this will be done in vulnscan-db
type Store interface {
func (m Match) String() string {
return fmt.Sprintf("Match(pkg=%s vuln=%s key='%s' confidence=%f)", m.Package.String(), m.Vulnerability.String(), m.SearchKey, m.Confidence)
}