Skip to content

proposal: cmd/covdata: html subcommand #71299

@3052

Description

@3052

Proposal Details

if you need multi run coverage, it seems you currently have two options. first option:

go test -cover '-test.gocoverdir' cover -run Zero
go test -cover '-test.gocoverdir' cover -run One
go tool covdata textfmt -i cover -o cover.txt
go tool cover -html cover.txt

second option:

go test -coverprofile zero.txt -run Zero
go test -coverprofile one.txt -run One
# manually merge files
go tool cover -html cover.txt

with the first option, you are having to convert to the legacy format [1] before you can get HTML output. with the second option, it seems no current method is available for multiple runs using the text format, meaning user needs to manually combine the resulting files somehow. to that end, I propose adding a new subcommand:

go tool covdata html -i cover -o cover.html
  1. https://go.dev/doc/build-cover#converting-to-legacy-text-format

Metadata

Metadata

Assignees

No one assigned

    Labels

    ProposalToolProposalIssues describing a requested change to a Go tool or command-line program.

    Type

    No type

    Projects

    Status

    Incoming

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions