-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
cmd/go: go 1.22.0: go test throws errors when processing folders not listed in coverpkg argument #65653
Comments
Thanks for opening this issue, Martin. |
Thanks for the report. I will take a look. |
Got bunch of CI pipelines broken after 1.22 upgrade with same Edit: |
Looks like this was introduced in 36e75f6 |
I am also facing this problem, but the go test program returns an exit status specifically on windows only |
Adding smoke tests in all packages to circumvent go1.22 issue: golang/go#65653 Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
Adding smoke tests in all packages to circumvent go1.22 issue: golang/go#65653 Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
Change https://go.dev/cl/568835 mentions this issue: |
Thanks for the reports. I have sent a patch https://go.dev/cl/568835 that should fix this issue, if anyone wants to try it out. |
@thanm I tested in two projects and experience no more issues after applying your patch. Thanks, looking forward to the release. |
@thanm Hi! As this fix already flew over the 1.22.1, may we hope that it will be cherry-picked to 1.22.2? I have high hopes for it, we have several dozens of broken pipelines here. Thank you in advance! |
I will bring up this possibility with the release team, but given that there is a workaround it seems unlikely that this sort of backport would be approved. Backports are generally reserved for serious problems (compiler or runtime crash, incorrect results, etc) with no workaround. We'll see. |
Thank you! Yeah, we already keep in mind workaround with |
See golang/go#65653, the fix can be postponed up to Go 1.23 and we need green. Signed-off-by: Roman Khimov <roman@nspcc.ru>
For what it's worth, applying the patch on the 1.22 release branch for my local builds works fine. |
@gopherbot please consider this for backport to 1.22 |
Backport issue(s) opened: #66137 (for 1.22). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases. |
Change https://go.dev/cl/569575 mentions this issue: |
This fixes a bug with the CI tests that was introduced with the upgrade to Go version 1.22.1 due to changes in how the "coverpkg" argument works, see: golang/go#65653. - Modify Makefile test and test-race targets based on artefactual-sdps/enduro targets - Add Makefile test-ci target from artefactual-sdps/enduro - Update .github/workflows/test.yml to use `make test-ci` to run tests - Delete hack/coverpkgs.sh
This fixes a bug with the CI tests that was introduced with the upgrade to Go version 1.22.1 due to changes in how the "coverpkg" argument works, see: golang/go#65653. - Modify Makefile test and test-race targets based on artefactual-sdps/enduro targets - Add Makefile test-ci target from artefactual-sdps/enduro - Update .github/workflows/test.yml to use `make test-ci` to run tests - Delete hack/coverpkgs.sh
This fixes a bug with the CI tests that was introduced with the upgrade to Go version 1.22.1 due to changes in how the "coverpkg" argument works, see: golang/go#65653. - Modify Makefile test and test-race targets based on artefactual-sdps/enduro targets - Add Makefile test-ci target from artefactual-sdps/enduro - Update .github/workflows/test.yml to use `make test-ci` to run tests - Delete hack/coverpkgs.sh
Has this landed on gotip yet? I run into this issue using gotip just pulled a few moments ago. |
Yes, this is landed on tip. If you are still seeing it (or something like it) I would be interested in a reproducer. |
Thanks! It seems it was a problem of the shell alias not carrying into a shell script. |
…est packages This patch fixes a bug in the code that reports coverage percentages and/or profiles for packages without tests. Specifically, the code added as part of the fix for issue 24570 (in CL 495447) didn't properly consider the -coverpkg selection and would look for the build action meta-data file for a package that wasn't actually selected for coverage. Updates #65653. Fixes #66137. Change-Id: I66ffac11783c00a8cbd855fd05b9a90e4e0ed402 Reviewed-on: https://go-review.googlesource.com/c/go/+/568835 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Bryan Mills <bcmills@google.com> (cherry picked from commit 2b22fc1) Reviewed-on: https://go-review.googlesource.com/c/go/+/569575
Go version
go version go1.22.0 linux/amd64, go version go1.22.0 darwin/amd64, go version go1.22.0 windows/amd64
Output of
go env
in your module/workspace:What did you do?
Have a
main.go
and a packageinternal
with some functions.See reproducer: https://github.com/sonic-martin/golang-test-cover
Run
go test
:go test -v ./... -coverprofile=coverage.out -coverpkg=./internal/... -covermode count go tool cover -html=coverage.out -o coverage.html go tool cover -func=coverage.out
What did you see happen?
coverage.out:
The both outputs of
go tool cover
are fine.What did you expect to see?
Before
go 1.22.0
it worked fine and nono such file or directory
errors happend.There are two workarounds:
(1)
go test
with-coverpkg
equal to the folder/packages processedBut changes semantic of the coverage result.
(2)
go test
withGOEXPERIMENT=nocoverageredesign
See the discussion from Brian Candler, Aldemar F, Thomas McNulty and me in the mailing list:
https://groups.google.com/g/golang-nuts/c/PjAWIdSdQHc
The text was updated successfully, but these errors were encountered: