mirror of
https://github.com/aquasecurity/trivy.git
synced 2026-02-15 05:03:19 +08:00
refactor(sbom): add intermediate representation for BOM (#6240)
Signed-off-by: knqyf263 <knqyf263@gmail.com> Co-authored-by: DmitriyLewen <91113035+DmitriyLewen@users.noreply.github.com>
This commit is contained in:
@@ -7,7 +7,7 @@ import (
|
||||
"github.com/liamg/jfather"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/aquasecurity/trivy/pkg/dependency/parser/types"
|
||||
"github.com/aquasecurity/trivy/pkg/dependency/types"
|
||||
xio "github.com/aquasecurity/trivy/pkg/x/io"
|
||||
)
|
||||
|
||||
@@ -39,9 +39,14 @@ func (p *Parser) Parse(r xio.ReadSeekerAt) ([]types.Library, []types.Dependency,
|
||||
var libs []types.Library
|
||||
for pkgName, dependency := range lockFile.Default {
|
||||
libs = append(libs, types.Library{
|
||||
Name: pkgName,
|
||||
Version: strings.TrimLeft(dependency.Version, "="),
|
||||
Locations: []types.Location{{StartLine: dependency.StartLine, EndLine: dependency.EndLine}},
|
||||
Name: pkgName,
|
||||
Version: strings.TrimLeft(dependency.Version, "="),
|
||||
Locations: []types.Location{
|
||||
{
|
||||
StartLine: dependency.StartLine,
|
||||
EndLine: dependency.EndLine,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
return libs, nil, nil
|
||||
|
||||
Reference in New Issue
Block a user