Fix closing file in writeJson and writeSarif (#1187)

This commit is contained in:
Oleksandr Redko authored and GitHub committed 2023-06-05 10:43:04 -05:00
1 parent 6dbb0c5af5
commit 190ac977be
2 files changed
+3

No files matched your search

+2
View File
@@ -9,6 +9,8 @@ func writeJson(findings []Finding, w io.WriteCloser) error {
if len(findings) == 0 {
findings = []Finding{}
}
defer w.Close()
encoder := json.NewEncoder(w)
encoder.SetIndent("", " ")
return encoder.Encode(findings)
+1
View File
@@ -14,6 +14,7 @@ func writeSarif(cfg config.Config, findings []Finding, w io.WriteCloser) error {
Version: "2.1.0",
Runs: getRuns(cfg, findings),
}
defer w.Close()
encoder := json.NewEncoder(w)
encoder.SetIndent("", " ")