@@ -10,8 +10,6 @@ import (
10
10
"github.com/snyk/parlay/pkg/parlay"
11
11
12
12
cdx "github.com/CycloneDX/cyclonedx-go"
13
- "github.com/package-url/packageurl-go"
14
- "github.com/remeh/sizedwaitgroup"
15
13
"github.com/spf13/cobra"
16
14
)
17
15
@@ -38,35 +36,7 @@ func NewEnrichCommand(logger *log.Logger) *cobra.Command {
38
36
panic (err )
39
37
}
40
38
41
- wg := sizedwaitgroup .New (20 )
42
-
43
- newComponents := make ([]cdx.Component , len (* bom .Components ))
44
-
45
- for i , component := range * bom .Components {
46
- wg .Add ()
47
- go func (component cdx.Component , i int ) {
48
- purl , _ := packageurl .FromString (component .PackageURL )
49
- resp , err := parlay .GetPackageData (purl )
50
- if err == nil {
51
- packageData := resp .JSON200
52
- if packageData != nil {
53
- if packageData .Description != nil {
54
- component .Description = * packageData .Description
55
- }
56
- if packageData .Licenses != nil {
57
- licences := cdx.LicenseChoice {Expression : * packageData .Licenses }
58
- component .Licenses = & cdx.Licenses {licences }
59
- }
60
- }
61
- }
62
- newComponents [i ] = component
63
- wg .Done ()
64
- }(component , i )
65
- }
66
-
67
- wg .Wait ()
68
-
69
- bom .Components = & newComponents
39
+ bom = parlay .EnrichSBOM (bom )
70
40
71
41
err = cdx .NewBOMEncoder (os .Stdout , cdx .BOMFileFormatJSON ).Encode (bom )
72
42
},
0 commit comments