mirror of
https://github.com/anchore/grype
synced 2024-11-10 06:34:13 +00:00
fix duplicate pkg output; add pkg type
This commit is contained in:
parent
5421021e4f
commit
077af63000
2 changed files with 3 additions and 8 deletions
|
@ -27,6 +27,7 @@ type ResultObj struct {
|
|||
type Package struct {
|
||||
Name string `json:"name"`
|
||||
Version string `json:"version"`
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
// Present creates a JSON-based reporting
|
||||
|
@ -35,18 +36,12 @@ func (pres *Presenter) Present(output io.Writer, catalog *pkg.Catalog, results r
|
|||
|
||||
for match := range results.Enumerate() {
|
||||
pkg := catalog.Package(match.Package.ID())
|
||||
doc = append(
|
||||
doc,
|
||||
ResultObj{
|
||||
Cve: match.Vulnerability.ID,
|
||||
Package: Package{Name: pkg.Name, Version: pkg.Version}},
|
||||
)
|
||||
|
||||
doc = append(
|
||||
doc,
|
||||
ResultObj{
|
||||
Cve: match.Vulnerability.ID,
|
||||
Package: Package{Name: pkg.Name, Version: pkg.Version}},
|
||||
Package: Package{Name: pkg.Name, Version: pkg.Version, Type: pkg.Type.String()}},
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
[{"cve":"CVE-1999-0001","package":{"name":"package-1","version":"1.0.1"}},{"cve":"CVE-1999-0001","package":{"name":"package-1","version":"1.0.1"}},{"cve":"CVE-1999-0002","package":{"name":"package-1","version":"1.0.1"}},{"cve":"CVE-1999-0002","package":{"name":"package-1","version":"1.0.1"}}]
|
||||
[{"cve":"CVE-1999-0001","package":{"name":"package-1","version":"1.0.1","type":"deb"}},{"cve":"CVE-1999-0002","package":{"name":"package-1","version":"1.0.1","type":"deb"}}]
|
Loading…
Reference in a new issue