You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ go test -coverprofile=foo.p ./...
...
$ go tool cover -html=foo.p
What did you expect to see?
No error from go tool -cover.
What did you see instead?
$ go test -coverprofile=foo.p ./...
? M/n [no test files]
M/xinternal/q coverage: 0.0% of statements
M/it coverage: 0.0% of statements
M/x coverage: 0.0% of statements
M/xinternal coverage: 0.0% of statements
ok M/a 0.022s coverage: 100.0% of statements
ok M/aa 0.020s coverage: 77.8% of statements
ok M/b 0.021s coverage: 100.0% of statements
ok M/deadstuff 0.019s coverage: 33.3% of statements
ok M/main 0.018s coverage: 75.0% of statements
ok M/onlytest 0.018s coverage: [no statements]
$ go tool cover -html=foo.p
cover: can't read "t.go": open /tmp/covex/t.go: no such file or directory
$
What's happening here is that the cover profile fragments generated for the no-test packages are being written to a temporary coverage profile that has an unqualified path, meaning that if multiple test runs are happening in parallel we'll get a collision (this is what happens with foo.p above).
The text was updated successfully, but these errors were encountered:
What version of Go are you using (
go version
)?Using tip:
Does this issue reproduce with the latest release?
No, only with tip.
What operating system and processor architecture are you using (
go env
)?linux/amd64
What did you do?
For this set of packages:
https://go.dev/play/p/5nloPBjspW9?v=gotip
run
What did you expect to see?
No error from go tool -cover.
What did you see instead?
What's happening here is that the cover profile fragments generated for the no-test packages are being written to a temporary coverage profile that has an unqualified path, meaning that if multiple test runs are happening in parallel we'll get a collision (this is what happens with foo.p above).
The text was updated successfully, but these errors were encountered: