mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 08:23:15 +01:00
* fix: sorting locations should consider pkg evidence Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * simplify location test options for comparison Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> --------- Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
27 lines
645 B
Go
27 lines
645 B
Go
package cmptest
|
|
|
|
import (
|
|
"github.com/google/go-cmp/cmp"
|
|
|
|
"github.com/anchore/syft/syft/file"
|
|
"github.com/anchore/syft/syft/pkg"
|
|
)
|
|
|
|
type LicenseComparer func(x, y pkg.License) bool
|
|
|
|
func DefaultLicenseComparer(x, y pkg.License) bool {
|
|
return cmp.Equal(
|
|
x, y,
|
|
cmp.Comparer(DefaultLocationComparer),
|
|
cmp.Comparer(buildSetComparer[file.Location, file.LocationSet](DefaultLocationComparer)),
|
|
)
|
|
}
|
|
|
|
func LicenseComparerWithoutLocationLayer(x, y pkg.License) bool {
|
|
return cmp.Equal(
|
|
x, y,
|
|
cmp.Comparer(LocationComparerWithoutLayer),
|
|
cmp.Comparer(buildSetComparer[file.Location, file.LocationSet](LocationComparerWithoutLayer)),
|
|
)
|
|
}
|