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: test -coverprofile with swig fails #64661
Comments
cc @thanm |
Thanks for the report. I'll take a look. |
I spent a little time looking at this. When using Go 1.19 or with Go 1.20 plus the "new coverage experiment" disabled (GOEXPERIMENT=nocoverageredesign), the swig-generated source file ( |
Change https://go.dev/cl/552095 mentions this issue: |
When building a package, run the cover tool on the collected go/cgo source files before invoking swig (if swig files are present), as opposed to running swig and then cover. Running swig adds new Go files to the "cgo" list, and we want to avoid running those newly generated files through the cover tool. Fixes golang#64661. Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest Change-Id: I32b6dad5c39fcf5e656c40fb3b44220c69320889 Reviewed-on: https://go-review.googlesource.com/c/go/+/552095 Auto-Submit: Than McIntosh <thanm@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Go version
go version go1.21.2 darwin/arm64
What operating system and processor architecture are you using (
go env
)?What did you do?
Use a simple project with a swig file in it: simple-test.zip
Run
go test
worksRun
go test -coverprofile .testCoverage.txt
fails with message:What did you expect to see?
go test -coverprofile
worksWhat did you see instead?
go test -coverprofile .testCoverage.txt
fails with message:Additionally the output when with
go test -x -coverprofile .testCoverage.txt
go test -x -coverprofile .testCoverage.txt
Also note that last version I used for this project go1.18 works. I also tested go1.21 on Linux/amd64, same error.
/cc @ianlancetaylor
The text was updated successfully, but these errors were encountered: