feat(report): IgnoredJSONKyes to clear values in result json (#1071)

* feat(report): IgnoredJSONKyes to clear values in result json

* fix(report): marshal indent in JSON everytime
This commit is contained in:
Kota Kanbe
2020-11-05 20:13:09 +09:00
committed by GitHub
parent 2fc3462d35
commit 93059b74c3
6 changed files with 211 additions and 185 deletions

View File

@@ -41,14 +41,8 @@ func (w LocalFileWriter) Write(rs ...models.ScanResult) (err error) {
}
var b []byte
if c.Conf.Debug {
if b, err = json.MarshalIndent(r, "", " "); err != nil {
return xerrors.Errorf("Failed to Marshal to JSON: %w", err)
}
} else {
if b, err = json.Marshal(r); err != nil {
return xerrors.Errorf("Failed to Marshal to JSON: %w", err)
}
if b, err = json.MarshalIndent(r, "", " "); err != nil {
return xerrors.Errorf("Failed to Marshal to JSON: %w", err)
}
if err := writeFile(p, b, 0600); err != nil {
return xerrors.Errorf("Failed to write JSON. path: %s, err: %w", p, err)