From 354f9f8b43608012e8192f2e8d9e13c615df5c34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Sat, 7 Jan 2017 18:45:34 +0000 Subject: [PATCH] cmd/cover: check os.Create error im html output The error was being written over by Execute. Change-Id: Id5965542bf4d414043fdbe70ee3f2f790728c01d Reviewed-on: https://go-review.googlesource.com/34954 Run-TryBot: Brad Fitzpatrick Reviewed-by: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- cmd/cover/html.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/cover/html.go b/cmd/cover/html.go index f6b226406a..ef50e2bfce 100644 --- a/cmd/cover/html.go +++ b/cmd/cover/html.go @@ -67,6 +67,9 @@ func htmlOutput(profile, outfile string) error { } else { out, err = os.Create(outfile) } + if err != nil { + return err + } err = htmlTemplate.Execute(out, d) if err == nil { err = out.Close()