github.com/noqcks/syft@v0.0.0-20230920222752-a9e2c4e288e5/syft/pkg/relationships_evident_by.go (about)

     1  package pkg
     2  
     3  import (
     4  	"github.com/anchore/syft/syft/artifact"
     5  )
     6  
     7  func RelationshipsEvidentBy(catalog *Collection) []artifact.Relationship {
     8  	var edges []artifact.Relationship
     9  	for _, p := range catalog.Sorted() {
    10  		for _, l := range p.Locations.ToSlice() {
    11  			if v, exists := l.Annotations[EvidenceAnnotationKey]; !exists || v != PrimaryEvidenceAnnotation {
    12  				// skip non-primary evidence from being expressed as a relationship.
    13  				// note: this may be configurable in the future.
    14  				continue
    15  			}
    16  			edges = append(edges, artifact.Relationship{
    17  				From: p,
    18  				To:   l.Coordinates,
    19  				Type: artifact.EvidentByRelationship,
    20  			})
    21  		}
    22  	}
    23  
    24  	return edges
    25  }