Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions go_coverage.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,16 @@ func getFunctionInfos(profiles []*cover.Profile) ([]*funcInfo, int64, int64, err
// Now match up functions and profile blocks.
for _, f := range funcs {
c, t := f.coverage(profile)
funcInfos = append(funcInfos,
&funcInfo{fileName: file,
functionName: f.name,
functionStartLine: f.startLine,
functionEndLine: f.endLine,
uncoveredLines: t - c})
total += t
covered += c
if t != 0 {
funcInfos = append(funcInfos,
&funcInfo{fileName: file,
functionName: f.name,
functionStartLine: f.startLine,
functionEndLine: f.endLine,
uncoveredLines: t - c})
total += t
covered += c
}
}
}
return funcInfos, total, covered, nil
Expand Down Expand Up @@ -270,9 +272,7 @@ func (f *FuncExtent) coverage(profile *cover.Profile) (num, den int64) {
covered += int64(b.NumStmt)
}
}
if total == 0 {
total = 1 // Avoid zero denominator.
}

return covered, total
}

Expand Down