]> Cypherpunks repositories - gostls13.git/commit
cmd/{go,cover}: fix for -coverprofile path capture with local pkg
authorThan McIntosh <thanm@google.com>
Wed, 26 Oct 2022 15:33:28 +0000 (11:33 -0400)
committerThan McIntosh <thanm@google.com>
Tue, 1 Nov 2022 14:11:54 +0000 (14:11 +0000)
commit2730170f633811ca42aa4086aab6396c58449535
treef61ea166ab7615fca10ca325012f635a69f22055
parenta3559f3301b54468c14d4997af0d617db60f4915
cmd/{go,cover}: fix for -coverprofile path capture with local pkg

When coverage testing a local package (defined by a relative import
path such as "./foo/bar") the convention when "-coverprofile" is used
has been to capture source files by full pathname, as opposed to
recording the full import path or the invented import path
("command-line-arguments/") created by the go command in the case of
building named Go files. Doing this makes it much easier to use
collected profiles with "go tool -cover -html=<profile>".

The support for this feature/convention wound up being inadvertantly
dropped during the GOEXPERIMENT=coverageredesign implementation; this
patch restores it.

Fixes #56433.

Change-Id: Ib9556fdc86011b00c155caa614ab23e5148f3eb4
Reviewed-on: https://go-review.googlesource.com/c/go/+/445917
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/cmd/cover/cover.go
src/cmd/go/internal/work/exec.go
src/cmd/go/testdata/script/cover_test_localpkg_filepath.txt [new file with mode: 0644]
src/internal/coverage/cmddefs.go