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/go: go 1.22.0 inconsistent and variable code coverage output for the same folder #65570
Comments
This is almost certainly an effect of recent changes in
See previously: (attn @thanm) |
Thanks for the report. I'll take a look. |
@dev-gto would you kindly post a pointer to the code that you are working with, so that I can reproduce the problem on my machine? Thanks. |
@thanm , actually my project is a private and large one. Despite some testing errors (the original project does not emit any errors), you can reproduce with go test -cover ./...
ok github.com/registrobr/zxcvbn-go (cached) coverage: 60.6% of statements
ok github.com/registrobr/zxcvbn-go/adjacency (cached) coverage: 40.8% of statements
github.com/registrobr/zxcvbn-go/data coverage: 0.0% of statements
github.com/registrobr/zxcvbn-go/data/ptbr coverage: 0.0% of statements
ok github.com/registrobr/zxcvbn-go/entropy (cached) coverage: 35.9% of statements
... go test -cover ./[ae]*
ok github.com/registrobr/zxcvbn-go/adjacency (cached) coverage: 83.3% of statements
ok github.com/registrobr/zxcvbn-go/entropy (cached) coverage: 50.0% of statements
|
#62212 might be related |
I've confirmed this with both @dev-gto's example above and a large private monorepo where I also encountered the issue. |
Indeed, |
hi! |
Code coverage has been broken for about a year now... Please can someone make this a priority to fix. |
I came here because I just ran into this as well on |
Go version
go version go1.22.0 linux/amd64
Output of
go env
in your module/workspace:What did you do?
Having a directory called, e.g.,
holiday
with some go files and their corresponding test files, I called thego test -cover
from the parent directory. Depending on directories arguments, I have different percentage values, which wasn't occurring on go < 1.22.0.What did you see happen?
What did you expect to see?
A consistent percentage value (in this case, 97.6%) for all commands:
The text was updated successfully, but these errors were encountered: