github.com/anchore/syft@v1.38.2/internal/cmptest/location.go (about)

     1  package cmptest
     2  
     3  import (
     4  	"github.com/google/go-cmp/cmp"
     5  	"github.com/google/go-cmp/cmp/cmpopts"
     6  
     7  	"github.com/anchore/syft/syft/file"
     8  )
     9  
    10  type LocationComparer func(x, y file.Location) bool
    11  
    12  func DefaultLocationComparer(x, y file.Location) bool {
    13  	return cmp.Equal(x.Coordinates, y.Coordinates, cmpopts.IgnoreUnexported(file.Coordinates{})) && cmp.Equal(x.AccessPath, y.AccessPath)
    14  }
    15  
    16  func LocationComparerWithoutLayer(x, y file.Location) bool {
    17  	return cmp.Equal(x.RealPath, y.RealPath) && cmp.Equal(x.AccessPath, y.AccessPath)
    18  }