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

Feature Request: Flag to disable disable recursive behavior #42

Closed
davecgh opened this issue May 8, 2013 · 3 comments
Closed

Feature Request: Flag to disable disable recursive behavior #42

davecgh opened this issue May 8, 2013 · 3 comments

Comments

@davecgh
Copy link

davecgh commented May 8, 2013

First, I want to thank you for this amazing tool. I've used it to get several packages to 100% test coverage now. Fantastic.

That said, perhaps I'm missing an option, but I would like to see the ability to only instrument and report the coverage for the top-level package under test (more generally, specifically named packages). There is already a way to exclude packages by name, however, I find myself not wanting to see test coverage for dependencies far more often than I want to see it. Dependencies have their own tests which ensure they work properly.

For an actual example, https://github.com/davecgh/go-spew/spew has 100% test coverage. However, when I run gocov against another package I'm developing right now that makes use of it, it reports coverage not only for the package I'm running it against, but for spew as well. Since the package under test doesn't exercise spew fully (spew has its own tests for that), it dutifully reports low test coverage. I can, of course, exclude the package, but there are several more deps too (all of which have their own tests). This results in a ton of low percentage coverage reports that are largely irrelevant since, in my opinion, it's not the job of a top-level package to test dependencies directly.

I think it would be far easier if there were, at the very least, a flag to ignore imported packages other than the current one under test or specifically named packages on the command line. Best case for me would be to reverse the behavior altogether where gocov only tests (or at least reports) the specific named package(s) unless given a flag to recurse.

@axw
Copy link
Owner

axw commented May 8, 2013

Hi Dave,

Thank you for your kind words. I'm glad you've found gocov useful.

Do you have the latest version of gocov? There was a change some time ago that introduced a boolean "-deps" flag, which is false by default. This is meant to do what you're talking about - toggle coverage analysis of dependencies. If you have the latest, and you're not setting that, then it sounds like a bug. Could you please confirm?

Cheers,
Andrew

@davecgh
Copy link
Author

davecgh commented May 8, 2013

Doh! I did in fact need to update. The -deps flag set by default to false is exactly what I was after. Thanks for responding so quickly. I apologize for the already implemented request. I should've updated first.

@davecgh davecgh closed this as completed May 8, 2013
@axw
Copy link
Owner

axw commented May 8, 2013

No worries! Thanks for getting back - let me know if you have any problems with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants