Skip to content

cmd/go: go test -cover loses coverage of some inlined functions #23314

@soniakeys

Description

@soniakeys

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions