Skip to content

Commit

Permalink
Fix closing file in writeJson and writeSarif (#1187)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandear committed Jun 5, 2023
1 parent 6dbb0c5 commit 190ac97
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions report/json.go
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions report/sarif.go
Expand Up @@ -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("", " ")
Expand Down

0 comments on commit 190ac97

Please sign in to comment.