mirror of
https://github.com/aquasecurity/trivy.git
synced 2025-12-23 07:29:00 -08:00
refactor(deps): move dependencies to package (#2189)
This commit is contained in:
@@ -116,7 +116,7 @@ func (w Writer) Write(report types.Report) error {
|
||||
githubPkg := Package{}
|
||||
githubPkg.Scope = RuntimeScope
|
||||
githubPkg.Relationship = getPkgRelationshipType(pkg)
|
||||
githubPkg.Dependencies = getDependencies(result, pkg)
|
||||
githubPkg.Dependencies = pkg.DependsOn
|
||||
githubPkg.PackageUrl, err = buildPurl(result.Type, pkg)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("unable to build purl for %s: %w", pkg.Name, err)
|
||||
@@ -153,15 +153,6 @@ func getMetadata(report types.Report) Metadata {
|
||||
return metadata
|
||||
}
|
||||
|
||||
func getDependencies(result types.Result, pkg ftypes.Package) []string {
|
||||
for _, dep := range result.Dependencies {
|
||||
if dep.ID == pkg.ID {
|
||||
return dep.DependsOn
|
||||
}
|
||||
}
|
||||
return []string{}
|
||||
}
|
||||
|
||||
func getPkgRelationshipType(pkg ftypes.Package) string {
|
||||
if pkg.Indirect {
|
||||
return IndirectRelationship
|
||||
|
||||
Reference in New Issue
Block a user