github.com/anchore/syft@v1.4.2-0.20240516191711-1bec1fc5d397/internal/relationship/remove.go (about)

     1  package relationship
     2  
     3  import "github.com/anchore/syft/syft/artifact"
     4  
     5  // TODO: put under test...
     6  func RemoveRelationshipsByID(relationships []artifact.Relationship, id artifact.ID) []artifact.Relationship {
     7  	var filtered []artifact.Relationship
     8  	for _, r := range relationships {
     9  		if r.To.ID() != id && r.From.ID() != id {
    10  			filtered = append(filtered, r)
    11  		}
    12  	}
    13  	return filtered
    14  }