From 81ad3ed91a59e1d1bdba38025138df2fb921df76 Mon Sep 17 00:00:00 2001 From: owenrumney Date: Tue, 27 Oct 2020 11:34:00 +0000 Subject: [PATCH] Add pretty write --- sarif/sarif.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sarif/sarif.go b/sarif/sarif.go index 2d3266b..223fc31 100644 --- a/sarif/sarif.go +++ b/sarif/sarif.go @@ -58,3 +58,12 @@ func (sarif *Report) Write(w io.Writer) error { _, err = w.Write(marshal) return err } + +func (sarif *Report) PrettyWrite(w io.Writer) error { + marshal, err := json.MarshalIndent(sarif, "", " ") + if err != nil { + return err + } + _, err = w.Write(marshal) + return err +}