This is a tracking issue to remove the "CoverageRedesign" GOEXPERIMENT some time in the Go 1.21 release; at that point hopefully any remaining (potential) bugs/issues with the new coverage design will be ironed out, and we will no longer need the GOEXPERIMENT=nocoverageredesign fallback.
@thanm
Comment From: AlekSi
I guess the title should be updated too
Comment From: thanm
Thanks. Updated.
Comment From: thanm
Removing the experiment didn't make the 1.21 release, there are still some bugfix CLs not yet submitted (e.g. 495446, 495447, and 495452). Once those go in I should be in a better position to get rid of the experiment.
Comment From: tombrown52
@thanm Is this likely to be removed in 1.22, or bumped to 1.23? (I tried to find links to the issues you included, 495446, 495447, and 495452, but was unsuccessful)
Comment From: thanm
Hi @tombrown52,
Thanks for the note. That last comment I posted was a bit cryptic, sorry about that. "495446, 495447, and 495452" are Gerrit CLs, not issues. These CLs have now been merged, and bugs they were intended to address have been closed. More details with links:
CLs 495446 and 495447 are for issues #18909 and #24570.
CL 495452 is for issue #58770.
My intent was to have these fixed early in this cycle, but for a variety of reasons this didn't happen. As a result we're going to bump the deletion of GOEXPERIMENT=coverageredesign until the next release; with less than a month to go before the freeze, it is better to wait until early in the next cycle.
Comment From: tombrown52
@thanm Thanks for the update!
Comment From: thanm
Bumping milestone to 1.23
Comment From: Feggah
I have generated packages in my monorepo that I don't want to include in the coverage report. With GOEXPERIMENT=nocoverageredesign
they are not included.
If this is removed, how can I remove specific packages from the coverage? For example, I would like to ignore all packages within the paths:
- sdk/generated/**
- **/mocks/*
Is it possible to do that configuration in the go test
command?
Comment From: begelundmuller
Hi, I'm not able to tell if this issue has been resolved or is tracked elsewhere, but if we don't set GOEXPERIMENT=nocoverageredesign
, we get the following errors for two packages in our repository:
github.com/rilldata/rill/proto/gen/rill/admin/v1: open /tmp/go-build1717652986/b205/covmeta.efd544d54abd57024320e5b09e7fbb7333ec3c9e2c058a3d351094eaca3dd4d6: no such file or directory
github.com/rilldata/rill/proto/gen/rill/runtime/v1: open /tmp/go-build1717652986/b324/covmeta.067b3bf4a6ecbbbcd442d5d3dfcb816dbf6bc1aee18591e902bf98c6b115f2e7: no such file or directory
I believe the error originates from here: https://github.com/golang/go/blob/b5a64ba62eafe5dee13562091ca03aef6cac87b6/src/cmd/go/internal/test/test.go#L1411
It seems there is some edge case in the coverage redesign where BuildActionCoverMetaFile
looks for a cover meta file that doesn't exist.
Comment From: thanm
@begelundmuller thanks for the report. The problem you posted about is being tracked in https://github.com/golang/go/issues/65653.
Comment From: ChrisHines
Please don't remove GOEXPERIMENT=nocoverageredesign
until https://github.com/golang/go/issues/65570 is resolved.
Comment From: thanm
I have a fix out for #65570, but at this point it is too late to be removing this experiment in 1.23, bumping to 1.24.
Comment From: AlekSi
@thanm Probably, the title should be updated too
Comment From: linzhp
Bazel support for Go still rely on nocoverageredesign
: https://github.com/bazel-contrib/rules_go/blob/141d91231e8d303d7164656c7bb746f988154cd2/go/private/sdk.bzl#L508
Do you think Go team can add the support in Bazel? Or at least keep it around until Bazel community catch up?
Comment From: thanm
Something to keep in mind is that "go tool -cover" still works exactly the same even with GOEXPERIMENT=coverageredesign turned on, e.g.
$ go tool cover -o hellocover.go -mode set hello.go
will give you the same results, so if this is what Bazel is doing (in combination with bazel-specific runtime code), things should continue to work.
If on the other hand Bazel is invoking the "go" command, e.g. "go test -cover ..." then you will definitely still need to disable the experiment.
Comment From: linzhp
Bazel calls go tool cover
, but the resulting test binary no longer recognize -test.coverprofile
:
testing: cannot use -test.coverprofile because test binary was not built with coverage enabled
Based on https://github.com/bazel-contrib/rules_go/issues/3513#issuecomment-1570264940, Bazel needs to pass additional flags to go tool cover
and go tool compile
.
Comment From: sluongng
https://github.com/golang/go/commit/41298239cf8b0de14fd3ac43e4af65fad6ab5cc4 It seems like this was merged to Go tips and will be part of 1.25 release.
@linzhp we probably need some adjustments on rules_go side.
Comment From: linzhp
Feel free to send a pull request to me or @fmeum