mirror of
https://github.com/anchore/syft
synced 2024-11-10 06:14:16 +00:00
17ef243956
* chore(deps): update tools to latest versions Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix: update to new linter rules Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com> --------- Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com> Co-authored-by: spiffcs <32073428+spiffcs@users.noreply.github.com> Co-authored-by: Christopher Phillips <christopher.phillips@anchore.com>
35 lines
834 B
Go
35 lines
834 B
Go
package task
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/anchore/syft/internal/relationship"
|
|
"github.com/anchore/syft/internal/sbomsync"
|
|
"github.com/anchore/syft/syft/artifact"
|
|
"github.com/anchore/syft/syft/cataloging"
|
|
"github.com/anchore/syft/syft/file"
|
|
"github.com/anchore/syft/syft/source"
|
|
)
|
|
|
|
var _ artifact.Identifiable = (*sourceIdentifierAdapter)(nil)
|
|
|
|
type sourceIdentifierAdapter struct {
|
|
desc source.Description
|
|
}
|
|
|
|
func (s sourceIdentifierAdapter) ID() artifact.ID {
|
|
return artifact.ID(s.desc.ID)
|
|
}
|
|
|
|
func NewRelationshipsTask(cfg cataloging.RelationshipsConfig, src source.Description) Task {
|
|
fn := func(_ context.Context, _ file.Resolver, builder sbomsync.Builder) error {
|
|
relationship.Finalize(
|
|
builder,
|
|
cfg,
|
|
&sourceIdentifierAdapter{desc: src})
|
|
|
|
return nil
|
|
}
|
|
|
|
return NewTask("relationships-cataloger", fn)
|
|
}
|