github.com/anchore/syft@v1.38.2/internal/cmptest/license.go (about) 1 package cmptest 2 3 import ( 4 "github.com/google/go-cmp/cmp" 5 6 "github.com/anchore/syft/syft/file" 7 "github.com/anchore/syft/syft/pkg" 8 ) 9 10 type LicenseComparer func(x, y pkg.License) bool 11 12 func DefaultLicenseComparer(x, y pkg.License) bool { 13 return cmp.Equal( 14 x, y, 15 cmp.Comparer(DefaultLocationComparer), 16 cmp.Comparer(buildSetComparer[file.Location, file.LocationSet](DefaultLocationComparer, locationSorter)), 17 ) 18 } 19 20 func LicenseComparerWithoutLocationLayer(x, y pkg.License) bool { 21 return cmp.Equal( 22 x, y, 23 cmp.Comparer(LocationComparerWithoutLayer), 24 cmp.Comparer(buildSetComparer[file.Location, file.LocationSet](LocationComparerWithoutLayer, locationSorter)), 25 ) 26 }