golang/go

cmd/go: test coverage output twice

Open

#32,717 opened on Jun 20, 2019

View on GitHub
 (4 comments) (0 reactions) (0 assignees)Go (19,008 forks)batch import
GoCommandNeedsInvestigationhelp wanted

Repository metrics

Stars
 (133,883 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

What version of Go are you using (go version)?

What did you do?

$ go test -json -cover ./...

What did you expect to see?

Coverage statements output only once, or one of the events identified differently from the other.

{"Time":"2019-06-20T18:51:29.178821431-04:00","Action":"output","Package":"gotest.tools/assert/cmp","Output":"ok  \tgotest.tools/assert/cmp\t(cached)\tcoverage: 91.1% of statements\n"}
{"Time":"2019-06-20T18:51:29.183457861-04:00","Action":"output","Package":"gotest.tools/assert","Output":"ok  \tgotest.tools/assert\t(cached)\tcoverage: 85.2% of statements\n"}

What did you see instead?

Coverage statements output twice.

{"Time":"2019-06-20T18:51:29.178811583-04:00","Action":"output","Package":"gotest.tools/assert/cmp","Output":"coverage: 91.1% of statements\n"}
{"Time":"2019-06-20T18:51:29.178821431-04:00","Action":"output","Package":"gotest.tools/assert/cmp","Output":"ok  \tgotest.tools/assert/cmp\t(cached)\tcoverage: 91.1% of statements\n"}
{"Time":"2019-06-20T18:51:29.183452652-04:00","Action":"output","Package":"gotest.tools/assert","Output":"coverage: 85.2% of statements\n"}
{"Time":"2019-06-20T18:51:29.183457861-04:00","Action":"output","Package":"gotest.tools/assert","Output":"ok  \tgotest.tools/assert\t(cached)\tcoverage: 85.2% of statements\n"}

Related to #23036, if one of the events could be identified differently the duplicate output would be easy to filter out.

I noticed that go test -v has the same behaviour, but i'm not sure why.

Contributor guide