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: support branch coverage #28888

Closed
rillig opened this issue Nov 20, 2018 · 8 comments
Closed

cmd/cover: support branch coverage #28888

rillig opened this issue Nov 20, 2018 · 8 comments
Labels
FeatureRequest FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@rillig
Copy link
Contributor

rillig commented Nov 20, 2018

As of Go version 1.11, the cover tool only supports statement coverage, but not branch coverage.

It would be nice if branch coverage would be supported, too.

The current documentation of the cover source code doesn't mention whether it was an intentional decision to support only statement coverage or whether it was omitted because of low priority.

See this Stack Overflow question.

@bcmills bcmills added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. FeatureRequest labels Nov 20, 2018
@bcmills bcmills added this to the Unplanned milestone Nov 20, 2018
@bcmills
Copy link
Contributor

bcmills commented Nov 20, 2018

@ianthehat, do you know who owns cmd/cover? I don't see an entry in https://dev.golang.org/owners/.

@dgryski
Copy link
Contributor

dgryski commented Nov 20, 2018

Previous issues have been handled by @robpike .

@ianthehat
Copy link

Not sure, you could make an argument for compiler, tools or open source teams owning that one.
I don't think we have an existing owner or expert right now.
@andybons we should probably take the time to make sure that /owners/ is complete and has owners for everything that is not deprecated

@robpike
Copy link
Contributor

robpike commented Nov 20, 2018

It was a consequence of the design, not deliberate and not accidental. I think it's fine and would prefer to leave things as they are. The simplicity of the current implementation is worth a lot.

@rillig
Copy link
Contributor Author

rillig commented Nov 21, 2018

Thank you for sharing your views. I agree that the current code is really simple to read and understand (although it's of course a difficult topic), which makes a really good starting point for third-party products to implement the branch coverage.

@rillig rillig closed this as completed Nov 21, 2018
@mvdan
Copy link
Member

mvdan commented Nov 21, 2018

I see the argument for not doing it, but I've wanted this in the past. Perhaps a more powerful coverage tool could exist in the x/tools repository.

@dgryski
Copy link
Contributor

dgryski commented Nov 21, 2018

Wouldn't the instrumentation pass need to run after the compiler has linearized the expressions? I don't see how that could be a standalone tool.

@rillig
Copy link
Contributor Author

rillig commented Nov 24, 2018

@mvdan, @dgryski I have extended junhwi/gobco in a pull request so that it does everything I want for now.

@golang golang locked and limited conversation to collaborators Nov 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FeatureRequest FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

7 participants