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

proposal: cmd/cover: add flags to print coverage percentages over packages or files #45846

Open
golopot opened this issue Apr 29, 2021 · 1 comment

Comments

@golopot
Copy link

golopot commented Apr 29, 2021

Command cover can print coverage summary for each functions with go tool cover -func=c.out. But sometimes it is too much detail for me. The report would be more readable if the coverage summary were grouped by files or packages.

Examples:

$ go tool cover -func=out
root/a/foo.go:10:		fooF			20%
root/a/foo.go:20:		fooG			30%
root/a/foo.go:30:		fooH			30%
root/a/foo2.go:30: 		foo2F			30%
root/b/goo.go:30:		gooF			50%
root/b/goo.go:40:		gooG			50%

# imaginary flag 
$ go tool cover -summary-for-files=out
root/a/foo.go			90%
root/a/foo2.go			90%
root/b/goo.go			70%

# imaginary flag
$ go tool cover -summary-for-packages=out
root/a			90%
root/b			90%
@gopherbot gopherbot added this to the Proposal milestone Apr 29, 2021
@ianlancetaylor ianlancetaylor added this to Incoming in Proposals (old) Apr 29, 2021
@rsc
Copy link
Contributor

rsc commented May 5, 2021

/cc @jfaller, who was talking about better coverage support generally.
Placing on hold for that work.

@rsc rsc moved this from Incoming to Hold in Proposals (old) May 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Hold
Development

No branches or pull requests

3 participants