Rename Result object to Matches (#153)

* rename result to matches

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>

* renames NewResult to NewMatches

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
Alex Goodman 2020-09-17 06:02:17 -04:00 committed by GitHub
parent ad7d9d5fdb
commit ca8ac613e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 93 additions and 97 deletions

View file

@ -167,11 +167,11 @@ func startWorker(userInput string) <-chan error {
return
}
results := grype.FindVulnerabilitiesForCatalog(provider, *theDistro, catalog)
matches := grype.FindVulnerabilitiesForCatalog(provider, *theDistro, catalog)
bus.Publish(partybus.Event{
Type: event.VulnerabilityScanningFinished,
Value: presenter.GetPresenter(appConfig.PresenterOpt, results, catalog, *theScope, metadataProvider),
Value: presenter.GetPresenter(appConfig.PresenterOpt, matches, catalog, *theScope, metadataProvider),
})
}()
return errs

View file

@ -129,12 +129,12 @@ func candidateProducts(p *pkg.Package) []string {
}
func MatchWithoutVersion(c CPE, candidates []CPE) []CPE {
results := make([]CPE, 0)
matches := make([]CPE, 0)
for _, candidate := range candidates {
canCopy := candidate
if c.MatchWithoutVersion(&canCopy) {
results = append(results, candidate)
matches = append(matches, candidate)
}
}
return results
return matches
}

View file

@ -1,6 +1,7 @@
package grype
import (
"github.com/anchore/grype/grype/match"
"github.com/anchore/grype/internal/bus"
"github.com/wagoodman/go-partybus"
@ -9,7 +10,6 @@ import (
"github.com/anchore/grype/grype/logger"
"github.com/anchore/grype/grype/matcher"
"github.com/anchore/grype/grype/result"
"github.com/anchore/grype/grype/vulnerability"
"github.com/anchore/grype/internal/log"
"github.com/anchore/syft/syft"
@ -18,16 +18,16 @@ import (
"github.com/anchore/syft/syft/scope"
)
func FindVulnerabilities(provider vulnerability.Provider, userImageStr string, scopeOpt scope.Option) (result.Result, *pkg.Catalog, *scope.Scope, error) {
func FindVulnerabilities(provider vulnerability.Provider, userImageStr string, scopeOpt scope.Option) (match.Matches, *pkg.Catalog, *scope.Scope, error) {
catalog, theScope, theDistro, err := syft.Catalog(userImageStr, scopeOpt)
if err != nil {
return result.Result{}, nil, nil, err
return match.Matches{}, nil, nil, err
}
return FindVulnerabilitiesForCatalog(provider, *theDistro, catalog), catalog, theScope, nil
}
func FindVulnerabilitiesForCatalog(provider vulnerability.Provider, d distro.Distro, catalog *pkg.Catalog) result.Result {
func FindVulnerabilitiesForCatalog(provider vulnerability.Provider, d distro.Distro, catalog *pkg.Catalog) match.Matches {
packages := make([]*pkg.Package, 0)
for p := range catalog.Enumerate() {
packages = append(packages, p)
@ -35,7 +35,7 @@ func FindVulnerabilitiesForCatalog(provider vulnerability.Provider, d distro.Dis
return FindVulnerabilitiesForPackage(provider, d, packages...)
}
func FindVulnerabilitiesForPackage(provider vulnerability.Provider, d distro.Distro, packages ...*pkg.Package) result.Result {
func FindVulnerabilitiesForPackage(provider vulnerability.Provider, d distro.Distro, packages ...*pkg.Package) match.Matches {
return matcher.FindMatches(provider, d, packages...)
}

View file

@ -1,26 +1,21 @@
package result
package match
import (
"github.com/anchore/grype/grype/match"
"github.com/anchore/syft/syft/pkg"
)
// TODO: consider moving this to the pkg/match under matches.go
// TODO: consider renaming to Matches
type Result struct {
byPackage map[pkg.ID][]match.Match
type Matches struct {
byPackage map[pkg.ID][]Match
}
func NewResult() Result {
return Result{
byPackage: make(map[pkg.ID][]match.Match),
func NewMatches() Matches {
return Matches{
byPackage: make(map[pkg.ID][]Match),
}
}
// GetByPkgID returns a slice of potential matches from an ID
func (r *Result) GetByPkgID(id pkg.ID) []match.Match {
func (r *Matches) GetByPkgID(id pkg.ID) []Match {
matches, ok := r.byPackage[id]
if !ok {
return nil
@ -28,30 +23,30 @@ func (r *Result) GetByPkgID(id pkg.ID) []match.Match {
return matches
}
func (r *Result) Merge(other Result) {
func (r *Matches) Merge(other Matches) {
// note: de-duplication of matches is an upstream concern (not here)
for pkgID, matches := range other.byPackage {
r.add(pkgID, matches...)
}
}
func (r *Result) add(id pkg.ID, matches ...match.Match) {
func (r *Matches) add(id pkg.ID, matches ...Match) {
if len(matches) == 0 {
// only packages with matches should be added
return
}
if _, ok := r.byPackage[id]; !ok {
r.byPackage[id] = make([]match.Match, 0)
r.byPackage[id] = make([]Match, 0)
}
r.byPackage[id] = append(r.byPackage[id], matches...)
}
func (r *Result) Add(p *pkg.Package, matches ...match.Match) {
func (r *Matches) Add(p *pkg.Package, matches ...Match) {
r.add(p.ID(), matches...)
}
func (r *Result) Enumerate() <-chan match.Match {
channel := make(chan match.Match)
func (r *Matches) Enumerate() <-chan Match {
channel := make(chan Match)
go func() {
defer close(channel)
for _, matches := range r.byPackage {
@ -64,6 +59,6 @@ func (r *Result) Enumerate() <-chan match.Match {
}
// Count returns the total number of matches in a result
func (r *Result) Count() int {
func (r *Matches) Count() int {
return len(r.byPackage)
}

View file

@ -10,7 +10,6 @@ import (
"github.com/anchore/grype/grype/matcher/javascript"
"github.com/anchore/grype/grype/matcher/python"
"github.com/anchore/grype/grype/matcher/rpmdb"
"github.com/anchore/grype/grype/result"
"github.com/anchore/grype/grype/vulnerability"
"github.com/anchore/grype/internal/bus"
"github.com/anchore/grype/internal/log"
@ -76,8 +75,8 @@ func (c *controller) trackMatcher() (*progress.Manual, *progress.Manual) {
return &packagesProcessed, &vulnerabilitiesDiscovered
}
func (c *controller) findMatches(provider vulnerability.Provider, d distro.Distro, packages ...*pkg.Package) result.Result {
res := result.NewResult()
func (c *controller) findMatches(provider vulnerability.Provider, d distro.Distro, packages ...*pkg.Package) match.Matches {
res := match.NewMatches()
packagesProcessed, vulnerabilitiesDiscovered := c.trackMatcher()
@ -107,7 +106,7 @@ func (c *controller) findMatches(provider vulnerability.Provider, d distro.Distr
return res
}
func FindMatches(provider vulnerability.Provider, d distro.Distro, packages ...*pkg.Package) result.Result {
func FindMatches(provider vulnerability.Provider, d distro.Distro, packages ...*pkg.Package) match.Matches {
return controllerInstance.findMatches(provider, d, packages...)
}

View file

@ -6,7 +6,6 @@ import (
"strings"
"github.com/anchore/grype/grype/match"
"github.com/anchore/grype/grype/result"
"github.com/anchore/grype/grype/vulnerability"
"github.com/anchore/syft/syft/pkg"
syftCDX "github.com/anchore/syft/syft/presenter/cyclonedx"
@ -90,7 +89,7 @@ func NewVulnerability(m match.Match, p vulnerability.MetadataProvider) (Vulnerab
}
// NewDocumentFromCatalog returns a CycloneDX Document object populated with the vulnerability contents.
func NewDocumentFromCatalog(catalog *pkg.Catalog, matches result.Result, provider vulnerability.MetadataProvider) Document {
func NewDocumentFromCatalog(catalog *pkg.Catalog, matches match.Matches, provider vulnerability.MetadataProvider) Document {
bom := NewDocument()
for p := range catalog.Enumerate() {
// make a new compoent (by value)

View file

@ -5,7 +5,8 @@ import (
"fmt"
"io"
"github.com/anchore/grype/grype/result"
"github.com/anchore/grype/grype/match"
"github.com/anchore/grype/grype/vulnerability"
"github.com/anchore/syft/syft/pkg"
syftCDX "github.com/anchore/syft/syft/presenter/cyclonedx"
@ -14,14 +15,14 @@ import (
// Presenter writes a CycloneDX report from the given Catalog and Scope contents
type Presenter struct {
results result.Result
results match.Matches
catalog *pkg.Catalog
scope scope.Scope
metadataProvider vulnerability.MetadataProvider
}
// NewPresenter is a *Presenter constructor
func NewPresenter(results result.Result, catalog *pkg.Catalog, theScope scope.Scope, metadataProvider vulnerability.MetadataProvider) *Presenter {
func NewPresenter(results match.Matches, catalog *pkg.Catalog, theScope scope.Scope, metadataProvider vulnerability.MetadataProvider) *Presenter {
return &Presenter{
results: results,
catalog: catalog,

View file

@ -6,7 +6,6 @@ import (
"github.com/anchore/go-testutils"
"github.com/anchore/grype/grype/match"
"github.com/anchore/grype/grype/result"
"github.com/anchore/grype/grype/vulnerability"
"github.com/anchore/stereoscope/pkg/file"
"github.com/anchore/syft/syft/pkg"
@ -83,11 +82,11 @@ func TestCycloneDxDirsPresenter(t *testing.T) {
},
}
results := result.NewResult()
matches := match.NewMatches()
results.Add(&pkg1, match1, match2)
matches.Add(&pkg1, match1, match2)
pres := NewPresenter(results, catalog, s, newMetadataMock())
pres := NewPresenter(matches, catalog, s, newMetadataMock())
// run presenter
err = pres.Present(&buffer)

View file

@ -8,7 +8,6 @@ import (
"github.com/anchore/go-testutils"
"github.com/anchore/grype/grype/match"
"github.com/anchore/grype/grype/result"
"github.com/anchore/grype/grype/vulnerability"
"github.com/anchore/stereoscope/pkg/file"
"github.com/anchore/syft/syft/pkg"
@ -130,11 +129,11 @@ func TestCycloneDxImgsPresenter(t *testing.T) {
},
}
results := result.NewResult()
matches := match.NewMatches()
results.Add(&pkg1, match1, match2)
matches.Add(&pkg1, match1, match2)
pres := NewPresenter(results, catalog, s, newMetadataMock())
pres := NewPresenter(matches, catalog, s, newMetadataMock())
// run presenter
err = pres.Present(&buffer)

View file

@ -5,7 +5,8 @@ import (
"fmt"
"io"
"github.com/anchore/grype/grype/result"
"github.com/anchore/grype/grype/match"
"github.com/anchore/grype/grype/vulnerability"
"github.com/anchore/syft/syft/pkg"
syftJson "github.com/anchore/syft/syft/presenter/json"
@ -14,14 +15,14 @@ import (
// Presenter is a generic struct for holding fields needed for reporting
type Presenter struct {
results result.Result
results match.Matches
catalog *pkg.Catalog
scope scope.Scope
metadataProvider vulnerability.MetadataProvider
}
// NewPresenter is a *Presenter constructor
func NewPresenter(results result.Result, catalog *pkg.Catalog, theScope scope.Scope, metadataProvider vulnerability.MetadataProvider) *Presenter {
func NewPresenter(results match.Matches, catalog *pkg.Catalog, theScope scope.Scope, metadataProvider vulnerability.MetadataProvider) *Presenter {
return &Presenter{
results: results,
catalog: catalog,

View file

@ -10,7 +10,6 @@ import (
"github.com/anchore/go-testutils"
"github.com/anchore/grype/grype/match"
"github.com/anchore/grype/grype/result"
"github.com/anchore/grype/grype/vulnerability"
"github.com/anchore/syft/syft/pkg"
"github.com/sergi/go-diff/diffmatchpatch"
@ -142,8 +141,8 @@ func TestJsonPresenter(t *testing.T) {
},
}
results := result.NewResult()
results.Add(&pkg1, match1, match2, match3)
matches := match.NewMatches()
matches.Add(&pkg1, match1, match2, match3)
catalog := pkg.NewCatalog()
catalog.Add(pkg1)
@ -151,7 +150,7 @@ func TestJsonPresenter(t *testing.T) {
theScope, err := scope.NewScopeFromImage(img, scope.AllLayersScope)
pres := NewPresenter(results, catalog, theScope, newMetadataMock())
pres := NewPresenter(matches, catalog, theScope, newMetadataMock())
// TODO: add a constructor for a match.Match when the data is better shaped
@ -180,11 +179,11 @@ func TestEmptyJsonPresenter(t *testing.T) {
// Expected to have an empty JSON array back
var buffer bytes.Buffer
results := result.NewResult()
matches := match.NewMatches()
catalog := pkg.NewCatalog()
pres := NewPresenter(results, catalog, scope.Scope{}, nil)
pres := NewPresenter(matches, catalog, scope.Scope{}, nil)
// run presenter
err := pres.Present(&buffer)

View file

@ -3,13 +3,14 @@ package presenter
import (
"io"
"github.com/anchore/grype/grype/match"
"github.com/anchore/grype/grype/vulnerability"
"github.com/anchore/syft/syft/scope"
"github.com/anchore/grype/grype/presenter/cyclonedx"
"github.com/anchore/grype/grype/presenter/json"
"github.com/anchore/grype/grype/presenter/table"
"github.com/anchore/grype/grype/result"
"github.com/anchore/syft/syft/pkg"
)
@ -19,7 +20,7 @@ type Presenter interface {
}
// GetPresenter retrieves a Presenter that matches a CLI option
func GetPresenter(option Option, results result.Result, catalog *pkg.Catalog, theScope scope.Scope, metadataProvider vulnerability.MetadataProvider) Presenter {
func GetPresenter(option Option, results match.Matches, catalog *pkg.Catalog, theScope scope.Scope, metadataProvider vulnerability.MetadataProvider) Presenter {
switch option {
case JSONPresenter:
return json.NewPresenter(results, catalog, theScope, metadataProvider)

View file

@ -5,7 +5,8 @@ import (
"io"
"sort"
"github.com/anchore/grype/grype/result"
"github.com/anchore/grype/grype/match"
"github.com/anchore/grype/grype/vulnerability"
"github.com/anchore/syft/syft/pkg"
"github.com/olekukonko/tablewriter"
@ -13,13 +14,13 @@ import (
// Presenter is a generic struct for holding fields needed for reporting
type Presenter struct {
results result.Result
results match.Matches
catalog *pkg.Catalog
metadataProvider vulnerability.MetadataProvider
}
// NewPresenter is a *Presenter constructor
func NewPresenter(results result.Result, catalog *pkg.Catalog, metadataProvider vulnerability.MetadataProvider) *Presenter {
func NewPresenter(results match.Matches, catalog *pkg.Catalog, metadataProvider vulnerability.MetadataProvider) *Presenter {
return &Presenter{
results: results,
catalog: catalog,

View file

@ -7,7 +7,6 @@ import (
"github.com/anchore/go-testutils"
"github.com/anchore/grype/grype/match"
"github.com/anchore/grype/grype/result"
"github.com/anchore/grype/grype/vulnerability"
"github.com/anchore/syft/syft/pkg"
"github.com/sergi/go-diff/diffmatchpatch"
@ -99,9 +98,9 @@ func TestTablePresenter(t *testing.T) {
},
}
results := result.NewResult()
matches := match.NewMatches()
results.Add(&pkg1, match1, match2)
matches.Add(&pkg1, match1, match2)
catalog := pkg.NewCatalog()
@ -109,7 +108,7 @@ func TestTablePresenter(t *testing.T) {
catalog.Add(pkg1)
catalog.Add(pkg2)
pres := NewPresenter(results, catalog, newMetadataMock())
pres := NewPresenter(matches, catalog, newMetadataMock())
// TODO: add a constructor for a match.Match when the data is better shaped
@ -140,10 +139,10 @@ func TestEmptyTablePresenter(t *testing.T) {
var buffer bytes.Buffer
results := result.NewResult()
matches := match.NewMatches()
catalog := pkg.NewCatalog()
pres := NewPresenter(results, catalog, newMetadataMock())
pres := NewPresenter(matches, catalog, newMetadataMock())
// run presenter
err := pres.Present(&buffer)

View file

@ -1,3 +1,5 @@
//+build integration
package integration
import (

View file

@ -1,3 +1,5 @@
//+build integration
package integration
import (

View file

@ -8,7 +8,6 @@ import (
"github.com/anchore/go-testutils"
"github.com/anchore/grype/grype"
"github.com/anchore/grype/grype/match"
"github.com/anchore/grype/grype/result"
"github.com/anchore/grype/grype/vulnerability"
"github.com/anchore/grype/internal"
"github.com/anchore/syft/syft/pkg"
@ -28,7 +27,7 @@ func getPackagesByPath(t *testing.T, theScope scope.Scope, catalog *pkg.Catalog,
return catalog.PackagesByFile(refs[0])
}
func addAlpineMatches(t *testing.T, theScope scope.Scope, catalog *pkg.Catalog, theStore *mockStore, theResult *result.Result) {
func addAlpineMatches(t *testing.T, theScope scope.Scope, catalog *pkg.Catalog, theStore *mockStore, theResult *match.Matches) {
packages := getPackagesByPath(t, theScope, catalog, "/lib/apk/db/installed")
if len(packages) != 1 {
t.Logf("Alpine Packages: %+v", packages)
@ -57,7 +56,7 @@ func addAlpineMatches(t *testing.T, theScope scope.Scope, catalog *pkg.Catalog,
})
}
func addJavascriptMatches(t *testing.T, theScope scope.Scope, catalog *pkg.Catalog, theStore *mockStore, theResult *result.Result) {
func addJavascriptMatches(t *testing.T, theScope scope.Scope, catalog *pkg.Catalog, theStore *mockStore, theResult *match.Matches) {
packages := getPackagesByPath(t, theScope, catalog, "/javascript/pkg-lock/package-lock.json")
if len(packages) != 1 {
t.Logf("Javascript Packages: %+v", packages)
@ -85,7 +84,7 @@ func addJavascriptMatches(t *testing.T, theScope scope.Scope, catalog *pkg.Catal
})
}
func addPythonMatches(t *testing.T, theScope scope.Scope, catalog *pkg.Catalog, theStore *mockStore, theResult *result.Result) {
func addPythonMatches(t *testing.T, theScope scope.Scope, catalog *pkg.Catalog, theStore *mockStore, theResult *match.Matches) {
packages := getPackagesByPath(t, theScope, catalog, "/python/dist-info/METADATA")
if len(packages) != 1 {
t.Logf("Python Packages: %+v", packages)
@ -113,7 +112,7 @@ func addPythonMatches(t *testing.T, theScope scope.Scope, catalog *pkg.Catalog,
})
}
func addRubyMatches(t *testing.T, theScope scope.Scope, catalog *pkg.Catalog, theStore *mockStore, theResult *result.Result) {
func addRubyMatches(t *testing.T, theScope scope.Scope, catalog *pkg.Catalog, theStore *mockStore, theResult *match.Matches) {
packages := getPackagesByPath(t, theScope, catalog, "/ruby/Gemfile.lock")
if len(packages) != 1 {
t.Logf("Ruby Packages: %+v", packages)
@ -141,7 +140,7 @@ func addRubyMatches(t *testing.T, theScope scope.Scope, catalog *pkg.Catalog, th
})
}
func addJavaMatches(t *testing.T, theScope scope.Scope, catalog *pkg.Catalog, theStore *mockStore, theResult *result.Result) {
func addJavaMatches(t *testing.T, theScope scope.Scope, catalog *pkg.Catalog, theStore *mockStore, theResult *match.Matches) {
packages := make([]*pkg.Package, 0)
for p := range catalog.Enumerate(pkg.JavaPkg) {
packages = append(packages, p)
@ -176,7 +175,7 @@ func addJavaMatches(t *testing.T, theScope scope.Scope, catalog *pkg.Catalog, th
})
}
func addDpkgMatches(t *testing.T, theScope scope.Scope, catalog *pkg.Catalog, theStore *mockStore, theResult *result.Result) {
func addDpkgMatches(t *testing.T, theScope scope.Scope, catalog *pkg.Catalog, theStore *mockStore, theResult *match.Matches) {
packages := getPackagesByPath(t, theScope, catalog, "/var/lib/dpkg/status")
if len(packages) != 1 {
t.Logf("Dpkg Packages: %+v", packages)
@ -208,7 +207,7 @@ func addDpkgMatches(t *testing.T, theScope scope.Scope, catalog *pkg.Catalog, th
})
}
func addRhelMatches(t *testing.T, theScope scope.Scope, catalog *pkg.Catalog, theStore *mockStore, theResult *result.Result) {
func addRhelMatches(t *testing.T, theScope scope.Scope, catalog *pkg.Catalog, theStore *mockStore, theResult *match.Matches) {
packages := getPackagesByPath(t, theScope, catalog, "/var/lib/rpm/Packages")
if len(packages) != 1 {
t.Logf("RPMDB Packages: %+v", packages)
@ -249,34 +248,34 @@ func TestPkgCoverageImage(t *testing.T) {
tests := []struct {
fixtureImage string
expectedFn func(scope.Scope, *pkg.Catalog, *mockStore) result.Result
expectedFn func(scope.Scope, *pkg.Catalog, *mockStore) match.Matches
}{
{
fixtureImage: "image-debian-match-coverage",
expectedFn: func(theScope scope.Scope, catalog *pkg.Catalog, theStore *mockStore) result.Result {
expectedResults := result.NewResult()
addPythonMatches(t, theScope, catalog, theStore, &expectedResults)
addRubyMatches(t, theScope, catalog, theStore, &expectedResults)
addJavaMatches(t, theScope, catalog, theStore, &expectedResults)
addDpkgMatches(t, theScope, catalog, theStore, &expectedResults)
addJavascriptMatches(t, theScope, catalog, theStore, &expectedResults)
return expectedResults
expectedFn: func(theScope scope.Scope, catalog *pkg.Catalog, theStore *mockStore) match.Matches {
expectedMatches := match.NewMatches()
addPythonMatches(t, theScope, catalog, theStore, &expectedMatches)
addRubyMatches(t, theScope, catalog, theStore, &expectedMatches)
addJavaMatches(t, theScope, catalog, theStore, &expectedMatches)
addDpkgMatches(t, theScope, catalog, theStore, &expectedMatches)
addJavascriptMatches(t, theScope, catalog, theStore, &expectedMatches)
return expectedMatches
},
},
{
fixtureImage: "image-centos-match-coverage",
expectedFn: func(theScope scope.Scope, catalog *pkg.Catalog, theStore *mockStore) result.Result {
expectedResults := result.NewResult()
addRhelMatches(t, theScope, catalog, theStore, &expectedResults)
return expectedResults
expectedFn: func(theScope scope.Scope, catalog *pkg.Catalog, theStore *mockStore) match.Matches {
expectedMatches := match.NewMatches()
addRhelMatches(t, theScope, catalog, theStore, &expectedMatches)
return expectedMatches
},
},
{
fixtureImage: "image-alpine-match-coverage",
expectedFn: func(theScope scope.Scope, catalog *pkg.Catalog, theStore *mockStore) result.Result {
expectedResults := result.NewResult()
addAlpineMatches(t, theScope, catalog, theStore, &expectedResults)
return expectedResults
expectedFn: func(theScope scope.Scope, catalog *pkg.Catalog, theStore *mockStore) match.Matches {
expectedMatches := match.NewMatches()
addAlpineMatches(t, theScope, catalog, theStore, &expectedMatches)
return expectedMatches
},
},
}
@ -299,23 +298,23 @@ func TestPkgCoverageImage(t *testing.T) {
}
// build expected matches from what's discovered from the catalog
expectedResults := test.expectedFn(*theScope, catalog, theStore)
expectedMatches := test.expectedFn(*theScope, catalog, theStore)
// build expected match set...
expectedMatches := map[string]string{}
for eMatch := range expectedResults.Enumerate() {
expectedMatchSet := map[string]string{}
for eMatch := range expectedMatches.Enumerate() {
// NOTE: this does not include all fields...
expectedMatches[eMatch.Package.Name] = eMatch.String()
expectedMatchSet[eMatch.Package.Name] = eMatch.String()
}
expectedCount := len(expectedMatches)
expectedCount := len(expectedMatchSet)
// ensure that all matches are covered
actualCount := 0
for aMatch := range actualResults.Enumerate() {
actualCount++
observedMatchers.Add(aMatch.Matcher.String())
value, ok := expectedMatches[aMatch.Package.Name]
value, ok := expectedMatchSet[aMatch.Package.Name]
if !ok {
t.Errorf("Package: %s was expected but not found", aMatch.Package.Name)
}