mirror of
https://github.com/anchore/syft.git
synced 2026-10-30 22:12:28 +01:00
19 lines
548 B
Go
19 lines
548 B
Go
package cmptest
|
|
|
|
import (
|
|
"github.com/google/go-cmp/cmp"
|
|
"github.com/google/go-cmp/cmp/cmpopts"
|
|
|
|
"github.com/anchore/syft/syft/file"
|
|
)
|
|
|
|
type LocationComparer func(x, y file.Location) bool
|
|
|
|
func DefaultLocationComparer(x, y file.Location) bool {
|
|
return cmp.Equal(x.Coordinates, y.Coordinates, cmpopts.IgnoreUnexported(file.Coordinates{})) && cmp.Equal(x.AccessPath, y.AccessPath)
|
|
}
|
|
|
|
func LocationComparerWithoutLayer(x, y file.Location) bool {
|
|
return cmp.Equal(x.FullNestedPath(), y.FullNestedPath()) && cmp.Equal(x.AccessPath, y.AccessPath)
|
|
}
|