mirror of
https://github.com/anchore/syft.git
synced 2025-11-20 09:53:16 +01:00
sort json output for info command
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
parent
624668ada7
commit
5b96035d0a
@ -155,6 +155,14 @@ func renderCatalogerInfoJSON(doc *capabilities.Document, catalogers []capabiliti
|
|||||||
|
|
||||||
docOut := document{}
|
docOut := document{}
|
||||||
|
|
||||||
|
// sort catalogers by ecosystem then name
|
||||||
|
sort.Slice(catalogers, func(i, j int) bool {
|
||||||
|
if catalogers[i].Ecosystem != catalogers[j].Ecosystem {
|
||||||
|
return catalogers[i].Ecosystem < catalogers[j].Ecosystem
|
||||||
|
}
|
||||||
|
return catalogers[i].Name < catalogers[j].Name
|
||||||
|
})
|
||||||
|
|
||||||
for _, cat := range catalogers {
|
for _, cat := range catalogers {
|
||||||
info := catalogerInfo{
|
info := catalogerInfo{
|
||||||
Ecosystem: cat.Ecosystem,
|
Ecosystem: cat.Ecosystem,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user