Ensure that the Issues key in JSON format is a list (#2358)
This makes the data more consistent and easier to use with other tools. For example, a third-party tool can iterate over `Issues` without having to make a preliminary null check.
This commit is contained in:
parent
aa3550ab83
commit
e788757b32
@ -30,6 +30,9 @@ func (p JSON) Print(ctx context.Context, issues []result.Issue) error {
|
||||
Issues: issues,
|
||||
Report: p.rd,
|
||||
}
|
||||
if res.Issues == nil {
|
||||
res.Issues = []result.Issue{}
|
||||
}
|
||||
|
||||
outputJSON, err := json.Marshal(res)
|
||||
if err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user