Alex Goodman 34e5ff753f
Location order on packages should consider evidence annotations when sorting (#3720)
* 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>
2025-03-11 10:34:37 -04:00

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
}
}