golang/go

cmd/go: test coverage output twice

Aperta

#32.717 aperta il 20 giu 2019

 (4 commenti) (0 reazioni) (0 assegnatari)Go (19.008 fork)batch import
GoCommandNeedsInvestigationhelp wanted

Metriche repository

Star
 (133.883 stelle)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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.

Guida contributor