Write report only when leaks are found

This commit is contained in:
Cristhian Amaya committed 2018-12-11 18:33:11 +01:00
1 parent 98b025da72
commit 92bb4ea6fc
1 file changed
+4
+4
View File
@@ -345,6 +345,10 @@ func run() ([]Leak, error) {
// writeReport writes a report to a file specified in the --report= option.
// Default format for report is JSON. You can use the --csv option to write the report as a csv
func writeReport(leaks []Leak) error {
if len(leaks) == 0 {
return nil
}
var err error
log.Infof("writing report to %s", opts.Report)
if strings.HasSuffix(opts.Report, ".csv") {