golang/go

cmd/go: test coverage output twice

オープン

#32,717 opened on 2019/06/20

 (4 件のコメント) (0 件のリアクション) (0 人の担当者)Go (19,008 件のフォーク)batch import
GoCommandNeedsInvestigationhelp wanted

Repository metrics

Stars
 (133,883 個のスター)
PR merge metrics
 (30d に merged PR はありません)

説明

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.

コントリビューターガイド