check: omitempty rather than `null`

When using `-result-format=json` flag, just show populated fields.

Before:
```bash
$ gomtree -result-format=json -p ./bin -f ./bin.mtree
{"failures":[{"path":"gomtree","keyword":"size","expected":"2646101","got":"2930231"}],"Missing":null,"Extra":null}
```

After:
```bash
$ gomtree -result-format=json -p ./bin -f ./bin.mtree
{"failures":[{"path":"gomtree","keyword":"size","expected":"2646101","got":"2930231"}]}
```

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2016-07-25 15:39:55 -04:00
parent cc939615c7
commit 898661f983
1 changed files with 2 additions and 2 deletions

View File

@ -11,8 +11,8 @@ import (
type Result struct {
// list of any failures in the Check
Failures []Failure `json:"failures"`
Missing []Entry
Extra []Entry
Missing []Entry `json:"missing,omitempty"`
Extra []Entry `json:"extra,omitempty"`
}
// Failure of a particular keyword for a path