cmd/go: go test -cover loses coverage of some inlined functions #23314
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Bisected to ci ee4fbbc, "stop creating nested temp directory trees". Reproduces at tip as of Jan 2.
Does this issue reproduce with the latest release?
with 1.9.2, No.
What operating system and processor architecture are you using (
go env
)?linux/amd64
What did you do?
go get -t github.com/soniakeys/unit
go test -cover github.com/soniakeys/unit
(The issue happens on this package of mine, github.com/soniakeys/unit. I'm very sorry I don't have a small test case at the moment. I wanted to file the issue anyway to see if the information here was enough to spark some idea of the problem.)
What did you expect to see?
With 1.9.2, or up to the ci noted above,
ok github.com/soniakeys/unit 0.003s coverage: 100.0% of statements
What did you see instead?
From the noted ci or later built in ~/pt,
$ ~/pt/bin/go test -cover github.com/soniakeys/unit
ok github.com/soniakeys/unit 0.003s coverage: 63.4% of statements
The coverprofile showed the missing statements were one-liners, likely inlined. Sure enough, with '-l':
$ ~/pt/bin/go test -cover -gcflags=-l github.com/soniakeys/unit
ok github.com/soniakeys/unit 0.003s coverage: 100.0% of statements
The text was updated successfully, but these errors were encountered: