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

View file

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