Skip to content

Commit

Permalink
Make use of dependency license interface from cargo
Browse files Browse the repository at this point in the history
  • Loading branch information
Sophie Wigmore authored and ForestEckhardt committed Sep 24, 2021
1 parent b3d9187 commit 0d08091
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion internal/dependency.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ func convertToCargoDependency(dependency Dependency, dependencyName string) carg
for _, stack := range dependency.Stacks {
cargoDependency.Stacks = append(cargoDependency.Stacks, stack.ID)
}
cargoDependency.Licenses = append(cargoDependency.Licenses, dependency.Licenses...)

for _, l := range dependency.Licenses {
cargoDependency.Licenses = append(cargoDependency.Licenses, l)
}

return cargoDependency
}
6 changes: 3 additions & 3 deletions internal/dependency_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ func testDependency(t *testing.T, context spec.G, it spec.S) {
CPE: "cpe-notation",
PURL: "some-purl",
ID: "some-dep",
Licenses: []string{"fancy-license", "fancy-license-2"},
Licenses: []interface{}{"fancy-license", "fancy-license-2"},
Version: "1.0.0",
Stacks: []string{"some-stack"},
URI: "some-dep-uri",
Expand All @@ -326,7 +326,7 @@ func testDependency(t *testing.T, context spec.G, it spec.S) {
CPE: "cpe-notation",
PURL: "some-purl",
ID: "some-dep",
Licenses: []string{"fancy-license", "fancy-license-2"},
Licenses: []interface{}{"fancy-license", "fancy-license-2"},
Version: "1.1.2",
Stacks: []string{"some-stack-two"},
URI: "some-dep-uri-two",
Expand All @@ -338,7 +338,7 @@ func testDependency(t *testing.T, context spec.G, it spec.S) {
CPE: "cpe-notation",
PURL: "some-purl",
ID: "some-dep",
Licenses: []string{"fancy-license", "fancy-license-2"},
Licenses: []interface{}{"fancy-license", "fancy-license-2"},
Version: "1.5.6",
Stacks: []string{"some-stack-three"},
URI: "some-dep-uri-three",
Expand Down

0 comments on commit 0d08091

Please sign in to comment.