mirror of
https://github.com/anchore/grype
synced 2024-11-10 06:34:13 +00:00
Merge pull request #45 from anchore/fix-duplicate-options
deduplicate json presenter + add pkg type
This commit is contained in:
commit
350cf11a29
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