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>
25 lines
370 B
Go
25 lines
370 B
Go
package cmptest
|
|
|
|
type slicer[T any] interface {
|
|
ToSlice() []T
|
|
}
|
|
|
|
func buildSetComparer[T any, S slicer[T]](l func(x, y T) bool) func(x, y S) bool {
|
|
return func(x, y S) bool {
|
|
xs := x.ToSlice()
|
|
ys := y.ToSlice()
|
|
|
|
if len(xs) != len(ys) {
|
|
return false
|
|
}
|
|
for i, xe := range xs {
|
|
ye := ys[i]
|
|
if !l(xe, ye) {
|
|
return false
|
|
}
|
|
}
|
|
|
|
return true
|
|
}
|
|
}
|