cmd/cover: cross-package coverage logic has changed under gotoolchain 1.24 #71716
Labels
BugReport
Issues describing a possible bug in the Go implementation.
WaitingForInfo
Issue is not actionable because of missing required information, which needs to be provided.
Go version
go version go1.24.0 darwin/arm64
Output of
go env
in your module/workspace:What did you do?
We have modules comprising multiple packages, some of which are referenced only by tests within the other packages - for example, packages containing mocks, or utility funcs for asserts. These test-support packages do not themselves contain unit tests.
Under go version 1.23.6 the code coverage calculated by go test --coverprofile and go tool cover, is calculated as 100%.
Under go version 1.24.0 the code coverage drops - the test-support packages are reported as having 0% coverage.
Example:
/main/thing.go:
/main/think_test.go:
/testutil/testutil.go:
Then execute "go test" with coverprofile option, followed by "go tool cover", to calculate test coverage.
What did you see happen?
Output from running go test and go tool cover under go 1.24.0:
Output from running go test and go tool cover under go 1.23.6:
What did you expect to see?
As there is no reference in the Go 1.24.0 release notes to any changes in the test coverage calculation, I expected the output in 1.24.0 to be the same as in 1.23.6.
The text was updated successfully, but these errors were encountered: