From a733efbda5ffc8f76ca1f62b0c777c21d0254653 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sun, 13 Dec 2020 14:56:00 +0100 Subject: pkg/cover: don't show func coverage if we don't have it --- pkg/cover/html.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'pkg/cover/html.go') diff --git a/pkg/cover/html.go b/pkg/cover/html.go index 6212febf5..b353029a3 100644 --- a/pkg/cover/html.go +++ b/pkg/cover/html.go @@ -65,6 +65,7 @@ func (rg *ReportGenerator) DoHTML(w io.Writer, progs []Prog) error { Total: file.totalPCs, Covered: file.coveredPCs, }, + HasFunctions: len(file.functions) != 0, } pos.Files = append(pos.Files, f) if file.coveredPCs == 0 { @@ -354,7 +355,8 @@ type templateDir struct { type templateFile struct { templateBase - Index int + Index int + HasFunctions bool } var coverTemplate = template.Must(template.New("").Parse(` @@ -541,7 +543,8 @@ var coverTemplate = template.Must(template.New("").Parse(` {{$file.Name}} - + {{$file.Percent}}% of {{$file.Total}} -- cgit mrf-deployment