mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-12-01 05:24:22 +01:00
Fix closing file in writeJson and writeSarif (#1187)
This commit is contained in:
1 parent
6dbb0c5af5
commit
190ac977be
2 files changed
+3
No files matched your search
@@ -9,6 +9,8 @@ func writeJson(findings []Finding, w io.WriteCloser) error {
|
|||||||
if len(findings) == 0 {
|
if len(findings) == 0 {
|
||||||
findings = []Finding{}
|
findings = []Finding{}
|
||||||
}
|
}
|
||||||
|
defer w.Close()
|
||||||
|
|
||||||
encoder := json.NewEncoder(w)
|
encoder := json.NewEncoder(w)
|
||||||
encoder.SetIndent("", " ")
|
encoder.SetIndent("", " ")
|
||||||
return encoder.Encode(findings)
|
return encoder.Encode(findings)
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ func writeSarif(cfg config.Config, findings []Finding, w io.WriteCloser) error {
|
|||||||
Version: "2.1.0",
|
Version: "2.1.0",
|
||||||
Runs: getRuns(cfg, findings),
|
Runs: getRuns(cfg, findings),
|
||||||
}
|
}
|
||||||
|
defer w.Close()
|
||||||
|
|
||||||
encoder := json.NewEncoder(w)
|
encoder := json.NewEncoder(w)
|
||||||
encoder.SetIndent("", " ")
|
encoder.SetIndent("", " ")
|
||||||
|
|||||||
Reference in new issue
Block a user