Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/go: go test -cover & go test -coverprofile should always output a coverage #24570
Now in 1.10 when
Currently only packages that have at least one test (can be a
What version of Go are you using (
referenced this issue
May 30, 2018
#25492 is about the case where there are no statements to cover (and thus the percentage is undefined). That's materially different from the case here, where
That's the current issue title, but that behavior seems clearly wrong if there are no statements to cover:
(I guess we could output
I like the idea of a consistent output that would be created by just implementing this issue.
Another approach is, as in #25492, for all statements it is true that they are covered by the tests. So one could argue for 100% which is obviously mathematically incorrect.
I am also the creator of the CL. Happy to implement a solution that results from the discussion :)