github.com/anchore/syft@v1.38.2/internal/relationship/evident_by.go (about)

     1  package relationship
     2  
     3  import (
     4  	"github.com/anchore/syft/syft/artifact"
     5  	"github.com/anchore/syft/syft/pkg"
     6  )
     7  
     8  func EvidentBy(catalog *pkg.Collection) []artifact.Relationship {
     9  	var edges []artifact.Relationship
    10  	for _, p := range catalog.Sorted() {
    11  		for _, l := range p.Locations.ToSlice() {
    12  			kind := pkg.SupportingEvidenceAnnotation
    13  			if v, exists := l.Annotations[pkg.EvidenceAnnotationKey]; exists {
    14  				kind = v
    15  			}
    16  
    17  			edges = append(edges, artifact.Relationship{
    18  				From: p,
    19  				To:   l.Coordinates,
    20  				Type: artifact.EvidentByRelationship,
    21  				Data: map[string]string{
    22  					"kind": kind,
    23  				},
    24  			})
    25  		}
    26  	}
    27  
    28  	return edges
    29  }