From c30faf9c54a764b78db003de262517f0c7359ed2 Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Thu, 13 Jul 2023 17:30:34 -0400 Subject: [PATCH] cmd/covdata: format package comment for 'go doc' rendering MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Due to an errant newline, both 'go doc' and pkg.go.dev currently interpret the long comment in cmd/covdata/doc.go as a file comment instead of package documentation. Removing the errant newline caused 'go doc' to render the comment, but it does not strip out the interior '//' tokens from the '/* … */' block. Removing those tokens and fixing up indentation seems to give satisfactory rendering. Change-Id: I5757c649e7380b026f7d8d1b6fd3cb6dddfb27ad Reviewed-on: https://go-review.googlesource.com/c/go/+/509635 Reviewed-by: Than McIntosh TryBot-Result: Gopher Robot Run-TryBot: Bryan Mills Auto-Submit: Bryan Mills --- src/cmd/covdata/doc.go | 150 ++++++++++++++++++++--------------------- 1 file changed, 73 insertions(+), 77 deletions(-) diff --git a/src/cmd/covdata/doc.go b/src/cmd/covdata/doc.go index 924a742ed5..1836bb833c 100644 --- a/src/cmd/covdata/doc.go +++ b/src/cmd/covdata/doc.go @@ -3,82 +3,78 @@ // license that can be found in the LICENSE file. /* -// -// Covdata is a program for manipulating and generating reports -// from 2nd-generation coverage testing output files, those produced -// from running applications or integration tests. E.g. -// -// $ mkdir ./profiledir -// $ go build -cover -o myapp.exe . -// $ GOCOVERDIR=./profiledir ./myapp.exe -// $ ls ./profiledir -// covcounters.cce1b350af34b6d0fb59cc1725f0ee27.821598.1663006712821344241 -// covmeta.cce1b350af34b6d0fb59cc1725f0ee27 -// $ -// -// Run covdata via "go tool covdata ", where 'mode' is a subcommand -// selecting a specific reporting, merging, or data manipulation operation. -// Descriptions on the various modes (run "go tool cover -help" for -// specifics on usage of a given mode: -// -// 1. Report percent of statements covered in each profiled package -// -// $ go tool covdata percent -i=profiledir -// cov-example/p coverage: 41.1% of statements -// main coverage: 87.5% of statements -// $ -// -// -// 2. Report import paths of packages profiled -// -// $ go tool covdata pkglist -i=profiledir -// cov-example/p -// main -// $ -// -// 3. Report percent statements covered by function: -// -// $ go tool covdata func -i=profiledir -// cov-example/p/p.go:12: emptyFn 0.0% -// cov-example/p/p.go:32: Small 100.0% -// cov-example/p/p.go:47: Medium 90.9% -// ... -// $ -// -// 4. Convert coverage data to legacy textual format: -// -// $ go tool covdata textfmt -i=profiledir -o=cov.txt -// $ head cov.txt -// mode: set -// cov-example/p/p.go:12.22,13.2 0 0 -// cov-example/p/p.go:15.31,16.2 1 0 -// cov-example/p/p.go:16.3,18.3 0 0 -// cov-example/p/p.go:19.3,21.3 0 0 -// ... -// $ go tool cover -html=cov.txt -// $ -// -// 5. Merge profiles together: -// -// $ go tool covdata merge -i=indir1,indir2 -o=outdir -modpaths=github.com/go-delve/delve -// $ -// -// 6. Subtract one profile from another -// -// $ go tool covdata subtract -i=indir1,indir2 -o=outdir -// $ -// -// 7. Intersect profiles -// -// $ go tool covdata intersect -i=indir1,indir2 -o=outdir -// $ -// -// 8. Dump a profile for debugging purposes. -// -// $ go tool covdata debugdump -i=indir -// -// $ -// -*/ +Covdata is a program for manipulating and generating reports +from 2nd-generation coverage testing output files, those produced +from running applications or integration tests. E.g. + + $ mkdir ./profiledir + $ go build -cover -o myapp.exe . + $ GOCOVERDIR=./profiledir ./myapp.exe + $ ls ./profiledir + covcounters.cce1b350af34b6d0fb59cc1725f0ee27.821598.1663006712821344241 + covmeta.cce1b350af34b6d0fb59cc1725f0ee27 + $ + +Run covdata via "go tool covdata ", where 'mode' is a subcommand +selecting a specific reporting, merging, or data manipulation operation. +Descriptions on the various modes (run "go tool cover -help" for +specifics on usage of a given mode: + +1. Report percent of statements covered in each profiled package + + $ go tool covdata percent -i=profiledir + cov-example/p coverage: 41.1% of statements + main coverage: 87.5% of statements + $ + +2. Report import paths of packages profiled + + $ go tool covdata pkglist -i=profiledir + cov-example/p + main + $ + +3. Report percent statements covered by function: + + $ go tool covdata func -i=profiledir + cov-example/p/p.go:12: emptyFn 0.0% + cov-example/p/p.go:32: Small 100.0% + cov-example/p/p.go:47: Medium 90.9% + ... + $ + +4. Convert coverage data to legacy textual format: + $ go tool covdata textfmt -i=profiledir -o=cov.txt + $ head cov.txt + mode: set + cov-example/p/p.go:12.22,13.2 0 0 + cov-example/p/p.go:15.31,16.2 1 0 + cov-example/p/p.go:16.3,18.3 0 0 + cov-example/p/p.go:19.3,21.3 0 0 + ... + $ go tool cover -html=cov.txt + $ + +5. Merge profiles together: + + $ go tool covdata merge -i=indir1,indir2 -o=outdir -modpaths=github.com/go-delve/delve + $ + +6. Subtract one profile from another + + $ go tool covdata subtract -i=indir1,indir2 -o=outdir + $ + +7. Intersect profiles + + $ go tool covdata intersect -i=indir1,indir2 -o=outdir + $ + +8. Dump a profile for debugging purposes. + + $ go tool covdata debugdump -i=indir + + $ +*/ package main -- 2.50.0