Projects STRLCPY syft Commits fd02bef0
🤬
  • ■ ■ ■ ■
    syft/formats/common/cyclonedxhelpers/decoder.go
    skipped 53 lines
    54 54   
    55 55   s := &sbom.SBOM{
    56 56   Artifacts: sbom.Artifacts{
    57  - PackageCatalog: pkg.NewCatalog(),
     57 + PackageCatalog: pkg.NewCollection(),
    58 58   LinuxDistribution: linuxReleaseFromComponents(*bom.Components),
    59 59   },
    60 60   Source: extractComponents(bom.Metadata),
    skipped 214 lines
  • ■ ■ ■ ■ ■ ■
    syft/formats/common/spdxhelpers/to_format_model.go
    skipped 140 lines
    141 141   return spdx.ElementID(id)
    142 142  }
    143 143   
    144  -// packages populates all Package Information from the package Catalog (see https://spdx.github.io/spdx-spec/3-package-information/)
     144 +// packages populates all Package Information from the package Collection (see https://spdx.github.io/spdx-spec/3-package-information/)
    145 145  //
    146 146  //nolint:funlen
    147  -func toPackages(catalog *pkg.Catalog, sbom sbom.SBOM) (results []*spdx.Package) {
     147 +func toPackages(catalog *pkg.Collection, sbom sbom.SBOM) (results []*spdx.Package) {
    148 148   for _, p := range catalog.Sorted() {
    149 149   // name should be guaranteed to be unique, but semantically useful and stable
    150 150   id := toSPDXID(p)
    skipped 365 lines
    516 516   return ty
    517 517  }
    518 518   
    519  -func toOtherLicenses(catalog *pkg.Catalog) []*spdx.OtherLicense {
     519 +func toOtherLicenses(catalog *pkg.Collection) []*spdx.OtherLicense {
    520 520   licenses := map[string]bool{}
    521 521   for _, p := range catalog.Sorted() {
    522 522   for _, license := range parseLicenses(p.Licenses) {
    skipped 74 lines
  • ■ ■ ■ ■ ■ ■
    syft/formats/common/spdxhelpers/to_format_model_test.go
    skipped 420 lines
    421 421   
    422 422   for _, test := range tests {
    423 423   t.Run(test.name, func(t *testing.T) {
    424  - catalog := pkg.NewCatalog(test.pkg)
     424 + catalog := pkg.NewCollection(test.pkg)
    425 425   pkgs := toPackages(catalog, s)
    426 426   require.Len(t, pkgs, 1)
    427 427   for _, p := range pkgs {
    skipped 66 lines
    494 494   
    495 495   for _, test := range tests {
    496 496   t.Run(test.name, func(t *testing.T) {
    497  - catalog := pkg.NewCatalog(test.pkg)
     497 + catalog := pkg.NewCollection(test.pkg)
    498 498   otherLicenses := toOtherLicenses(catalog)
    499 499   require.Len(t, otherLicenses, len(test.expected))
    500 500   require.Equal(t, test.expected, otherLicenses)
    skipped 4 lines
  • ■ ■ ■ ■
    syft/formats/common/spdxhelpers/to_syft_model.go
    skipped 32 lines
    33 33   s := &sbom.SBOM{
    34 34   Source: src,
    35 35   Artifacts: sbom.Artifacts{
    36  - PackageCatalog: pkg.NewCatalog(),
     36 + PackageCatalog: pkg.NewCollection(),
    37 37   FileMetadata: map[source.Coordinates]source.FileMetadata{},
    38 38   FileDigests: map[source.Coordinates][]file.Digest{},
    39 39   LinuxDistribution: findLinuxReleaseByPURL(doc),
    skipped 371 lines
  • ■ ■ ■ ■
    syft/formats/github/encoder_test.go
    skipped 27 lines
    28 28   VersionID: "18.04",
    29 29   IDLike: []string{"debian"},
    30 30   },
    31  - PackageCatalog: pkg.NewCatalog(),
     31 + PackageCatalog: pkg.NewCollection(),
    32 32   },
    33 33   }
    34 34   for _, p := range []pkg.Package{
    skipped 128 lines
  • ■ ■ ■ ■ ■ ■
    syft/formats/internal/testutils/utils.go
    skipped 92 lines
    93 93   
    94 94  func ImageInput(t testing.TB, testImage string, options ...ImageOption) sbom.SBOM {
    95 95   t.Helper()
    96  - catalog := pkg.NewCatalog()
     96 + catalog := pkg.NewCollection()
    97 97   var cfg imageCfg
    98 98   var img *image.Image
    99 99   for _, opt := range options {
    skipped 45 lines
    145 145   return []byte(msg)
    146 146  }
    147 147   
    148  -func populateImageCatalog(catalog *pkg.Catalog, img *image.Image) {
     148 +func populateImageCatalog(catalog *pkg.Collection, img *image.Image) {
    149 149   _, ref1, _ := img.SquashedTree().File("/somefile-1.txt", filetree.FollowBasenameLinks)
    150 150   _, ref2, _ := img.SquashedTree().File("/somefile-2.txt", filetree.FollowBasenameLinks)
    151 151   
    skipped 100 lines
    252 252   }
    253 253  }
    254 254   
    255  -func newDirectoryCatalog() *pkg.Catalog {
    256  - catalog := pkg.NewCatalog()
     255 +func newDirectoryCatalog() *pkg.Collection {
     256 + catalog := pkg.NewCollection()
    257 257   
    258 258   // populate catalog with test data
    259 259   catalog.Add(pkg.Package{
    skipped 43 lines
    303 303   return catalog
    304 304  }
    305 305   
    306  -func newDirectoryCatalogWithAuthorField() *pkg.Catalog {
    307  - catalog := pkg.NewCatalog()
     306 +func newDirectoryCatalogWithAuthorField() *pkg.Collection {
     307 + catalog := pkg.NewCollection()
    308 308   
    309 309   // populate catalog with test data
    310 310   catalog.Add(pkg.Package{
    skipped 78 lines
  • ■ ■ ■ ■
    syft/formats/spdxtagvalue/encoder_test.go
    skipped 48 lines
    49 49   Format(),
    50 50   sbom.SBOM{
    51 51   Artifacts: sbom.Artifacts{
    52  - PackageCatalog: pkg.NewCatalog(pkgs...),
     52 + PackageCatalog: pkg.NewCollection(pkgs...),
    53 53   },
    54 54   Relationships: nil,
    55 55   Source: source.Metadata{
    skipped 42 lines
  • ■ ■ ■ ■
    syft/formats/syftjson/encoder_test.go
    skipped 46 lines
    47 47  }
    48 48   
    49 49  func TestEncodeFullJSONDocument(t *testing.T) {
    50  - catalog := pkg.NewCatalog()
     50 + catalog := pkg.NewCollection()
    51 51   
    52 52   p1 := pkg.Package{
    53 53   Name: "package-1",
    skipped 162 lines
  • ■ ■ ■ ■
    syft/formats/syftjson/to_format_model.go
    skipped 172 lines
    173 173   }
    174 174  }
    175 175   
    176  -func toPackageModels(catalog *pkg.Catalog) []model.Package {
     176 +func toPackageModels(catalog *pkg.Collection) []model.Package {
    177 177   artifacts := make([]model.Package, 0)
    178 178   if catalog == nil {
    179 179   return artifacts
    skipped 95 lines
  • ■ ■ ■ ■ ■ ■
    syft/formats/syftjson/to_syft_model.go
    skipped 130 lines
    131 131   }
    132 132  }
    133 133   
    134  -func toSyftRelationships(doc *model.Document, catalog *pkg.Catalog, relationships []model.Relationship, idAliases map[string]string) []artifact.Relationship {
     134 +func toSyftRelationships(doc *model.Document, catalog *pkg.Collection, relationships []model.Relationship, idAliases map[string]string) []artifact.Relationship {
    135 135   idMap := make(map[string]interface{})
    136 136   
    137 137   for _, p := range catalog.Sorted() {
    skipped 118 lines
    256 256   return nil
    257 257  }
    258 258   
    259  -func toSyftCatalog(pkgs []model.Package, idAliases map[string]string) *pkg.Catalog {
    260  - catalog := pkg.NewCatalog()
     259 +func toSyftCatalog(pkgs []model.Package, idAliases map[string]string) *pkg.Collection {
     260 + catalog := pkg.NewCollection()
    261 261   for _, p := range pkgs {
    262 262   catalog.Add(toSyftPackage(p, idAliases))
    263 263   }
    skipped 43 lines
  • ■ ■ ■ ■ ■ ■
    syft/lib.go
    skipped 33 lines
    34 34  // CatalogPackages takes an inventory of packages from the given image from a particular perspective
    35 35  // (e.g. squashed source, all-layers source). Returns the discovered set of packages, the identified Linux
    36 36  // distribution, and the source object used to wrap the data source.
    37  -func CatalogPackages(src *source.Source, cfg cataloger.Config) (*pkg.Catalog, []artifact.Relationship, *linux.Release, error) {
     37 +func CatalogPackages(src *source.Source, cfg cataloger.Config) (*pkg.Collection, []artifact.Relationship, *linux.Release, error) {
    38 38   resolver, err := src.FileResolver(cfg.Search.Scope)
    39 39   if err != nil {
    40 40   return nil, nil, nil, fmt.Errorf("unable to determine resolver while cataloging packages: %w", err)
    skipped 35 lines
    76 76   return catalog, relationships, release, err
    77 77  }
    78 78   
    79  -func newSourceRelationshipsFromCatalog(src *source.Source, c *pkg.Catalog) []artifact.Relationship {
     79 +func newSourceRelationshipsFromCatalog(src *source.Source, c *pkg.Collection) []artifact.Relationship {
    80 80   relationships := make([]artifact.Relationship, 0) // Should we pre-allocate this by giving catalog a Len() method?
    81 81   for p := range c.Enumerate() {
    82 82   relationships = append(relationships, artifact.Relationship{
    skipped 19 lines
  • ■ ■ ■ ■ ■ ■
    syft/pkg/catalog.go
    skipped 9 lines
    10 10   "github.com/anchore/syft/syft/artifact"
    11 11  )
    12 12   
    13  -type orderedIDSet struct {
    14  - slice []artifact.ID
    15  -}
    16  - 
    17  -func (s *orderedIDSet) add(ids ...artifact.ID) {
    18  -loopNewIDs:
    19  - for _, newID := range ids {
    20  - for _, existingID := range s.slice {
    21  - if existingID == newID {
    22  - continue loopNewIDs
    23  - }
    24  - }
    25  - s.slice = append(s.slice, newID)
    26  - }
    27  -}
    28  - 
    29  -func (s *orderedIDSet) delete(id artifact.ID) {
    30  - for i, existingID := range s.slice {
    31  - if existingID == id {
    32  - s.slice = append(s.slice[:i], s.slice[i+1:]...)
    33  - return
    34  - }
    35  - }
    36  -}
    37  - 
    38  -// Catalog represents a collection of Packages.
    39  -type Catalog struct {
     13 +// Collection represents a collection of Packages.
     14 +type Collection struct {
    40 15   byID map[artifact.ID]Package
    41 16   idsByName map[string]orderedIDSet
    42 17   idsByType map[Type]orderedIDSet
    skipped 1 lines
    44 19   lock sync.RWMutex
    45 20  }
    46 21   
    47  -// NewCatalog returns a new empty Catalog
    48  -func NewCatalog(pkgs ...Package) *Catalog {
    49  - catalog := Catalog{
     22 +// NewCollection returns a new empty Collection
     23 +func NewCollection(pkgs ...Package) *Collection {
     24 + catalog := Collection{
    50 25   byID: make(map[artifact.ID]Package),
    51 26   idsByName: make(map[string]orderedIDSet),
    52 27   idsByType: make(map[Type]orderedIDSet),
    skipped 8 lines
    61 36  }
    62 37   
    63 38  // PackageCount returns the total number of packages that have been added.
    64  -func (c *Catalog) PackageCount() int {
     39 +func (c *Collection) PackageCount() int {
    65 40   return len(c.byID)
    66 41  }
    67 42   
    68 43  // Package returns the package with the given ID.
    69  -func (c *Catalog) Package(id artifact.ID) *Package {
     44 +func (c *Collection) Package(id artifact.ID) *Package {
    70 45   v, exists := c.byID[id]
    71 46   if !exists {
    72 47   return nil
    skipped 8 lines
    81 56  }
    82 57   
    83 58  // PackagesByPath returns all packages that were discovered from the given path.
    84  -func (c *Catalog) PackagesByPath(path string) []Package {
     59 +func (c *Collection) PackagesByPath(path string) []Package {
    85 60   return c.Packages(c.idsByPath[path].slice)
    86 61  }
    87 62   
    88 63  // PackagesByName returns all packages that were discovered with a matching name.
    89  -func (c *Catalog) PackagesByName(name string) []Package {
     64 +func (c *Collection) PackagesByName(name string) []Package {
    90 65   return c.Packages(c.idsByName[name].slice)
    91 66  }
    92 67   
    93 68  // Packages returns all packages for the given ID.
    94  -func (c *Catalog) Packages(ids []artifact.ID) (result []Package) {
     69 +func (c *Collection) Packages(ids []artifact.ID) (result []Package) {
    95 70   for _, i := range ids {
    96 71   p, exists := c.byID[i]
    97 72   if exists {
    skipped 4 lines
    102 77  }
    103 78   
    104 79  // Add n packages to the catalog.
    105  -func (c *Catalog) Add(pkgs ...Package) {
     80 +func (c *Collection) Add(pkgs ...Package) {
    106 81   c.lock.Lock()
    107 82   defer c.lock.Unlock()
    108 83   
    skipped 20 lines
    129 104   }
    130 105  }
    131 106   
    132  -func (c *Catalog) addToIndex(p Package) {
     107 +func (c *Collection) addToIndex(p Package) {
    133 108   c.byID[p.id] = p
    134 109   c.addNameToIndex(p)
    135 110   c.addTypeToIndex(p)
    136 111   c.addPathsToIndex(p)
    137 112  }
    138 113   
    139  -func (c *Catalog) addNameToIndex(p Package) {
     114 +func (c *Collection) addNameToIndex(p Package) {
    140 115   nameIndex := c.idsByName[p.Name]
    141 116   nameIndex.add(p.id)
    142 117   c.idsByName[p.Name] = nameIndex
    143 118  }
    144 119   
    145  -func (c *Catalog) addTypeToIndex(p Package) {
     120 +func (c *Collection) addTypeToIndex(p Package) {
    146 121   typeIndex := c.idsByType[p.Type]
    147 122   typeIndex.add(p.id)
    148 123   c.idsByType[p.Type] = typeIndex
    149 124  }
    150 125   
    151  -func (c *Catalog) addPathsToIndex(p Package) {
     126 +func (c *Collection) addPathsToIndex(p Package) {
    152 127   observedPaths := internal.NewStringSet()
    153 128   for _, l := range p.Locations.ToSlice() {
    154 129   if l.RealPath != "" && !observedPaths.Contains(l.RealPath) {
    skipped 7 lines
    162 137   }
    163 138  }
    164 139   
    165  -func (c *Catalog) addPathToIndex(id artifact.ID, path string) {
     140 +func (c *Collection) addPathToIndex(id artifact.ID, path string) {
    166 141   pathIndex := c.idsByPath[path]
    167 142   pathIndex.add(id)
    168 143   c.idsByPath[path] = pathIndex
    169 144  }
    170 145   
    171  -func (c *Catalog) Delete(ids ...artifact.ID) {
     146 +func (c *Collection) Delete(ids ...artifact.ID) {
    172 147   c.lock.Lock()
    173 148   defer c.lock.Unlock()
    174 149   
    skipped 10 lines
    185 160   }
    186 161  }
    187 162   
    188  -func (c *Catalog) deleteNameFromIndex(p Package) {
     163 +func (c *Collection) deleteNameFromIndex(p Package) {
    189 164   nameIndex := c.idsByName[p.Name]
    190 165   nameIndex.delete(p.id)
    191 166   c.idsByName[p.Name] = nameIndex
    192 167  }
    193 168   
    194  -func (c *Catalog) deleteTypeFromIndex(p Package) {
     169 +func (c *Collection) deleteTypeFromIndex(p Package) {
    195 170   typeIndex := c.idsByType[p.Type]
    196 171   typeIndex.delete(p.id)
    197 172   c.idsByType[p.Type] = typeIndex
    198 173  }
    199 174   
    200  -func (c *Catalog) deletePathsFromIndex(p Package) {
     175 +func (c *Collection) deletePathsFromIndex(p Package) {
    201 176   observedPaths := internal.NewStringSet()
    202 177   for _, l := range p.Locations.ToSlice() {
    203 178   if l.RealPath != "" && !observedPaths.Contains(l.RealPath) {
    skipped 7 lines
    211 186   }
    212 187  }
    213 188   
    214  -func (c *Catalog) deletePathFromIndex(id artifact.ID, path string) {
     189 +func (c *Collection) deletePathFromIndex(id artifact.ID, path string) {
    215 190   pathIndex := c.idsByPath[path]
    216 191   pathIndex.delete(id)
    217 192   if len(pathIndex.slice) == 0 {
    skipped 4 lines
    222 197  }
    223 198   
    224 199  // Enumerate all packages for the given type(s), enumerating all packages if no type is specified.
    225  -func (c *Catalog) Enumerate(types ...Type) <-chan Package {
     200 +func (c *Collection) Enumerate(types ...Type) <-chan Package {
    226 201   channel := make(chan Package)
    227 202   go func() {
    228 203   defer close(channel)
    skipped 28 lines
    257 232   
    258 233  // Sorted enumerates all packages for the given types sorted by package name. Enumerates all packages if no type
    259 234  // is specified.
    260  -func (c *Catalog) Sorted(types ...Type) (pkgs []Package) {
     235 +func (c *Collection) Sorted(types ...Type) (pkgs []Package) {
    261 236   for p := range c.Enumerate(types...) {
    262 237   pkgs = append(pkgs, p)
    263 238   }
    skipped 3 lines
    267 242   return pkgs
    268 243  }
    269 244   
     245 +type orderedIDSet struct {
     246 + slice []artifact.ID
     247 +}
     248 + 
     249 +func (s *orderedIDSet) add(ids ...artifact.ID) {
     250 +loopNewIDs:
     251 + for _, newID := range ids {
     252 + for _, existingID := range s.slice {
     253 + if existingID == newID {
     254 + continue loopNewIDs
     255 + }
     256 + }
     257 + s.slice = append(s.slice, newID)
     258 + }
     259 +}
     260 + 
     261 +func (s *orderedIDSet) delete(id artifact.ID) {
     262 + for i, existingID := range s.slice {
     263 + if existingID == id {
     264 + s.slice = append(s.slice[:i], s.slice[i+1:]...)
     265 + return
     266 + }
     267 + }
     268 +}
     269 + 
  • ■ ■ ■ ■ ■ ■
    syft/pkg/catalog_test.go
    skipped 144 lines
    145 145   
    146 146   for _, test := range tests {
    147 147   t.Run(test.name, func(t *testing.T) {
    148  - c := NewCatalog()
     148 + c := NewCollection()
    149 149   for _, p := range test.pkgs {
    150 150   c.Add(p)
    151 151   }
    skipped 60 lines
    212 212   
    213 213   for _, test := range tests {
    214 214   t.Run(test.name, func(t *testing.T) {
    215  - c := NewCatalog(pkgs...)
     215 + c := NewCollection(pkgs...)
    216 216   assertIndexes(t, c, test.expectedIndexes)
    217 217   })
    218 218   }
    219 219  }
    220 220   
    221  -func assertIndexes(t *testing.T, c *Catalog, expectedIndexes expectedIndexes) {
     221 +func assertIndexes(t *testing.T, c *Collection, expectedIndexes expectedIndexes) {
    222 222   // assert path index
    223 223   assert.Len(t, c.idsByPath, len(expectedIndexes.byPath), "unexpected path index length")
    224 224   for path, expectedIds := range expectedIndexes.byPath {
    skipped 81 lines
    306 306   for _, test := range tests {
    307 307   t.Run(test.name, func(t *testing.T) {
    308 308   for _, path := range test.paths {
    309  - actualPackages := NewCatalog(test.pkgs...).PackagesByPath(path)
     309 + actualPackages := NewCollection(test.pkgs...).PackagesByPath(path)
    310 310   require.Len(t, actualPackages, 1)
    311 311   }
    312 312   })
    skipped 60 lines
    373 373   
    374 374   for _, tt := range tests {
    375 375   t.Run(tt.name, func(t *testing.T) {
    376  - actual := NewCatalog(tt.pkgs...).PackagesByPath("/b/path")
     376 + actual := NewCollection(tt.pkgs...).PackagesByPath("/b/path")
    377 377   require.Len(t, actual, 1)
    378 378   assert.Equal(t, tt.expectedLocations, actual[0].Locations.ToSlice())
    379 379   require.Len(t, actual[0].CPEs, tt.expectedCPECount)
    skipped 2 lines
    382 382  }
    383 383   
    384 384  func TestCatalog_EnumerateNilCatalog(t *testing.T) {
    385  - var c *Catalog
     385 + var c *Collection
    386 386   assert.Empty(t, c.Enumerate())
    387 387  }
    388 388   
    skipped 34 lines
  • ■ ■ ■ ■ ■ ■
    syft/pkg/cataloger/catalog.go
    skipped 104 lines
    105 105  // request.
    106 106  //
    107 107  //nolint:funlen
    108  -func Catalog(resolver source.FileResolver, _ *linux.Release, parallelism int, catalogers ...pkg.Cataloger) (*pkg.Catalog, []artifact.Relationship, error) {
    109  - catalog := pkg.NewCatalog()
     108 +func Catalog(resolver source.FileResolver, _ *linux.Release, parallelism int, catalogers ...pkg.Cataloger) (*pkg.Collection, []artifact.Relationship, error) {
     109 + catalog := pkg.NewCollection()
    110 110   var allRelationships []artifact.Relationship
    111 111   
    112 112   filesProcessed, packagesDiscovered := newMonitor()
    skipped 112 lines
  • ■ ■ ■ ■ ■ ■
    syft/pkg/deprecated.go
     1 +package pkg
     2 + 
     3 +// Deprecated: use Collection instead
     4 +type Catalog = Collection
     5 + 
     6 +// Deprecated: use NewCollection() instead
     7 +func NewCatalog(pkgs ...Package) *Catalog {
     8 + return NewCollection(pkgs...)
     9 +}
     10 + 
  • ■ ■ ■ ■
    syft/pkg/relationships.go
    skipped 1 lines
    2 2   
    3 3  import "github.com/anchore/syft/syft/artifact"
    4 4   
    5  -func NewRelationships(catalog *Catalog) []artifact.Relationship {
     5 +func NewRelationships(catalog *Collection) []artifact.Relationship {
    6 6   rels := RelationshipsByFileOwnership(catalog)
    7 7   rels = append(rels, RelationshipsEvidentBy(catalog)...)
    8 8   return rels
    skipped 2 lines
  • ■ ■ ■ ■ ■ ■
    syft/pkg/relationships_by_file_ownership.go
    skipped 30 lines
    31 31   
    32 32  // RelationshipsByFileOwnership creates a package-to-package relationship based on discovering which packages have
    33 33  // evidence locations that overlap with ownership claim from another package's package manager metadata.
    34  -func RelationshipsByFileOwnership(catalog *Catalog) []artifact.Relationship {
     34 +func RelationshipsByFileOwnership(catalog *Collection) []artifact.Relationship {
    35 35   var relationships = findOwnershipByFilesRelationships(catalog)
    36 36   
    37 37   var edges []artifact.Relationship
    skipped 17 lines
    55 55   
    56 56  // findOwnershipByFilesRelationships find overlaps in file ownership with a file that defines another package. Specifically, a .Location.Path of
    57 57  // a package is found to be owned by another (from the owner's .Metadata.Files[]).
    58  -func findOwnershipByFilesRelationships(catalog *Catalog) map[artifact.ID]map[artifact.ID]*strset.Set {
     58 +func findOwnershipByFilesRelationships(catalog *Collection) map[artifact.ID]map[artifact.ID]*strset.Set {
    59 59   var relationships = make(map[artifact.ID]map[artifact.ID]*strset.Set)
    60 60   
    61 61   if catalog == nil {
    skipped 55 lines
  • ■ ■ ■ ■
    syft/pkg/relationships_by_file_ownership_test.go
    skipped 138 lines
    139 139   for _, test := range tests {
    140 140   t.Run(test.name, func(t *testing.T) {
    141 141   pkgs, expectedRelations := test.setup(t)
    142  - c := NewCatalog(pkgs...)
     142 + c := NewCollection(pkgs...)
    143 143   relationships := RelationshipsByFileOwnership(c)
    144 144   
    145 145   assert.Len(t, relationships, len(expectedRelations))
    skipped 11 lines
  • ■ ■ ■ ■
    syft/pkg/relationships_evident_by.go
    skipped 3 lines
    4 4   "github.com/anchore/syft/syft/artifact"
    5 5  )
    6 6   
    7  -func RelationshipsEvidentBy(catalog *Catalog) []artifact.Relationship {
     7 +func RelationshipsEvidentBy(catalog *Collection) []artifact.Relationship {
    8 8   var edges []artifact.Relationship
    9 9   for _, p := range catalog.Sorted() {
    10 10   for _, l := range p.Locations.ToSlice() {
    skipped 16 lines
  • ■ ■ ■ ■ ■ ■
    syft/pkg/relationships_evident_by_test.go
    skipped 11 lines
    12 12   
    13 13  func TestRelationshipsEvidentBy(t *testing.T) {
    14 14   
    15  - c := NewCatalog()
     15 + c := NewCollection()
    16 16   
    17 17   coordA := source.Coordinates{
    18 18   RealPath: "/somewhere/real",
    skipped 34 lines
    53 53   
    54 54   tests := []struct {
    55 55   name string
    56  - catalog *Catalog
     56 + catalog *Collection
    57 57   want []artifact.Relationship
    58 58   }{
    59 59   {
    skipped 29 lines
  • ■ ■ ■ ■
    syft/sbom/sbom.go
    skipped 19 lines
    20 20  }
    21 21   
    22 22  type Artifacts struct {
    23  - PackageCatalog *pkg.Catalog
     23 + PackageCatalog *pkg.Collection
    24 24   FileMetadata map[source.Coordinates]source.FileMetadata
    25 25   FileDigests map[source.Coordinates][]file.Digest
    26 26   FileContents map[source.Coordinates]string
    skipped 85 lines
  • ■ ■ ■ ■
    test/integration/catalog_packages_test.go
    skipped 21 lines
    22 22   imagetest.GetFixtureImage(b, "docker-archive", fixtureImageName)
    23 23   tarPath := imagetest.GetFixtureImageTarPath(b, fixtureImageName)
    24 24   
    25  - var pc *pkg.Catalog
     25 + var pc *pkg.Collection
    26 26   for _, c := range cataloger.ImageCatalogers(cataloger.DefaultConfig()) {
    27 27   // in case of future alteration where state is persisted, assume no dependency is safe to reuse
    28 28   userInput := "docker-archive:" + tarPath
    skipped 292 lines
Please wait...
Page is in error, reload to recover