Skip to content

proposal: cmd/cover: support branch coverage #70306

@sywhang

Description

@sywhang

Proposal Details

Currently, the go test tool provides line-based coverage reporting. However, branch coverage support is not available, which limits the granularity of test coverage reporting. Adding branch coverage would be beneficial, as it would allow developers to better understand which branches (conditional paths) in their code are being executed during tests, rather than just which lines.

Not that it matters too much but another point to consider is that many other languages and testing frameworks (e.g., Python's coverage.py, Java's Jacoco) offer branch coverage.

Third party package like https://github.com/rillig/gobco implements tools that add additional instrumentations to ones generated by cmd/cover, but having this supported by official cover tool would be a nice addition to the Go testing tool.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Incoming

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions