Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/cover: when a panic occurs cover still marks the whole basic block covered #10185

Closed
taruti opened this issue Mar 17, 2015 · 1 comment
Closed
Milestone

Comments

@taruti
Copy link
Contributor

taruti commented Mar 17, 2015

The code coverage tool marks whole basic blocks as being covered when a statement in the middle panics. This can be quite confusing when the panics are converted to errors elsewhere with recover.

...
panic("...")
somecode // This is marked as covered.

A whole example example repo can be found in https://github.com/taruti/coverpanicbug and be triggered with "go test -cover" which falsely claims 100% coverage.

Go version 1.4.1 linux/amd64 and tools repo revision 2206711.

@mikioh mikioh changed the title cover: when a panic occurs cover still marks the whole basic block covered cmd/cover: when a panic occurs cover still marks the whole basic block covered Mar 17, 2015
@robpike robpike self-assigned this Mar 21, 2015
@robpike
Copy link
Contributor

robpike commented Apr 8, 2015

@robpike robpike closed this as completed Apr 8, 2015
@mikioh mikioh added this to the Go1.5 milestone Apr 9, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
@rsc rsc unassigned robpike Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants