Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal: cmd/covdata: html subcommand #71299

Open
3052 opened this issue Jan 16, 2025 · 0 comments
Open

proposal: cmd/covdata: html subcommand #71299

3052 opened this issue Jan 16, 2025 · 0 comments
Labels
Proposal ToolProposal Issues describing a requested change to a Go tool or command-line program.
Milestone

Comments

@3052
Copy link

3052 commented Jan 16, 2025

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
@3052 3052 added the Proposal label Jan 16, 2025
@gopherbot gopherbot added this to the Proposal milestone Jan 16, 2025
@gabyhelp gabyhelp added the ToolProposal Issues describing a requested change to a Go tool or command-line program. label Jan 17, 2025
@ianlancetaylor ianlancetaylor moved this to Incoming in Proposals Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Proposal ToolProposal Issues describing a requested change to a Go tool or command-line program.
Projects
Status: Incoming
Development

No branches or pull requests

3 participants