Open RomainMuller opened 3 months ago
Related Issues
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
I'm observing this issue with all go releases tested so far (1.21
, 1.22
, 1.23-rc
), and expect it is present on older releases, too.
Investigations so far (superficially) suggest that:
go build
would update the -importcfg
file passed to the compile
command to include sync/atomic
when building with -covermode=atomic
go list
on the other hand fails to do this, resulting in it failing to produce exports for packages that don't depend on sync/atomic
before they're instrumented.This is the same as https://github.com/golang/go/issues/65264, which has been closed/resolved on Feb 1st, so I was expecting the fix to be released already?
Oh my bad, it's fixed in 1.23.0-rc.1
apparently (my tests are failing for another reason).
I'm okay with this being closed; however I'd like to understand if there is any plan to back-port this fix to 1.21 and/or 1.22...
The fix in https://github.com/golang/go/commit/ac08c05d4daa11957fcada6db33f2150936bac27 looks simple enough to backport to me.
/cc @matloob @samthanawalla
Okay, created backport issues https://github.com/golang/go/issues/68221 and https://github.com/golang/go/issues/68222
Change https://go.dev/cl/595496 mentions this issue: [release-branch.go1.22] cmd/go: fix build config before creating actions for 'go list -cover'
Change https://go.dev/cl/595495 mentions this issue: [release-branch.go1.21] cmd/go: fix build config before creating actions for 'go list -cover'
Go version
go version go1.22.4 darwin/arm64
Output of
go env
in your module/workspace:What did you do?
Trying to use
go list
to obtain the exports for a given package and its dependencies; possibly built with coverage instrumentation... Use a command similar to the following (io
being a standard library package that runs into the issue, but this happens with virtually any other package that does not "already" depend onsync/atomic
):What did you see happen?
Removed
-deps
and-json
arguments as they are largely irrelevant to the issue; but basically:What did you expect to see?
I'd have expected compilation to succeed and exports to be returned (the
go build
equivalent command is successful):