From 92bb4ea6fc64aba4966ad0eecde5c5a6a33fb7d2 Mon Sep 17 00:00:00 2001 From: Cristhian Amaya Date: Tue, 11 Dec 2018 18:33:11 +0100 Subject: [PATCH] Write report only when leaks are found --- main.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main.go b/main.go index 476fc24f..0a834b75 100644 --- a/main.go +++ b/main.go @@ -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") {