bazel-contrib / bazel-contrib/rules_go

bazel coverage ... , the coverage data cannot count code block execution times

Open
#3,166 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
1.5k
Forks
760
Avg merge
1d 11h
Merged PRs (30d)
12

Description

### What version of rules_go are you using?

0.29.0

### What version of gazelle are you using?

0.23.0

### What version of Bazel are you using?

4.2.2

### Does this issue reproduce with the latest releases of all the above?

Yes

### What operating system and processor architecture are you using?
macos aarch64, also tested on Linux x86_64

### What did you do?

when running `bazel coverage ...` for my project, i get coverage data that only count whether a code block has been executed. like this
```
a/test.go:12.109,15.16 3 1
a/test1.go:19.2,19.36 1 1
a/test2.go:23.2,24.39 2 1
a/test3.go:67.16,70.3 2 0
```
the last element only count whether a code block has been executed

### What did you expect to see?
i want to get coverage data that can count the number of executions of code blocks.
like this
```
a/test.go:12.109,15.16 3 3
a/test1.go:19.2,19.36 1 2
a/test2.go:23.2,24.39 2 4
a/test3.go:67.16,70.3 2 0
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with `bazel coverage ...` using rules_go 0.29.0, Gazelle 0.23.0, and Bazel 4.2.2 on a representative Go project, then compare the generated coverage data with the expected execution counts. Read the coverage-related rules_go and Bazel integration identified during reproduction. Done means coverage entries report execution counts rather than only zero or one.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
build-system, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.