mirror of
https://github.com/anchore/syft.git
synced 2026-11-01 15:06:36 +01:00
fix: SPDX output performance with many relationships (#3053)
This commit is contained in:
@@ -35,6 +35,8 @@ type Descriptor struct {
|
||||
Configuration interface{}
|
||||
}
|
||||
|
||||
// RelationshipsSorted returns a sorted slice of all relationships
|
||||
// Deprecated -- use relationship.Index
|
||||
func (s SBOM) RelationshipsSorted() []artifact.Relationship {
|
||||
relationships := s.Relationships
|
||||
sort.SliceStable(relationships, func(i, j int) bool {
|
||||
@@ -70,6 +72,7 @@ func (s SBOM) AllCoordinates() []file.Coordinates {
|
||||
|
||||
// RelationshipsForPackage returns all relationships for the provided types.
|
||||
// If no types are provided, all relationships for the package are returned.
|
||||
// Deprecated -- use relationship.Index
|
||||
func (s SBOM) RelationshipsForPackage(p pkg.Package, rt ...artifact.RelationshipType) []artifact.Relationship {
|
||||
if len(rt) == 0 {
|
||||
rt = artifact.AllRelationshipTypes()
|
||||
@@ -103,6 +106,7 @@ func (s SBOM) RelationshipsForPackage(p pkg.Package, rt ...artifact.Relationship
|
||||
|
||||
// CoordinatesForPackage returns all coordinates for the provided package for provided relationship types
|
||||
// If no types are provided, all relationship types are considered.
|
||||
// Deprecated -- use relationship.Index
|
||||
func (s SBOM) CoordinatesForPackage(p pkg.Package, rt ...artifact.RelationshipType) []file.Coordinates {
|
||||
var coordinates []file.Coordinates
|
||||
for _, relationship := range s.RelationshipsForPackage(p, rt...) {
|
||||
|
||||
Reference in New Issue
Block a user