cmd/go: setting a global "-trimpath" untrims some temporary cgo files #24976
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What did you do?
Compile the Certificate.Verify example with a global trimpath:
$ go build -a -gcflags "all=-trimpath=${PWD}" .
The example code, for convenience
Then look at the file paths embedded in the file:
What did you expect to see?
For comparison, here's what happens with a local trimpath and without a trimpath:
In these cases,
_cgo_gotypes.go
is listed without an absolute path (or, for that matter, any path).What did you see instead?
_cgo_gotypes.go
is listed with an absolute path to a temporary location.Additional information
When running the builds with
-x
, I noticed the following commands in the output (pretty-printed here for readability) when using a global trimpath:It appears that, when multiple
-trimpath
flags are passed togo tool compile
, the last one wins, but only for cgo-generated files whose names start with an underscore (the other cgo-generated files don't appear to have their names recorded in the binary anywhere).System details
The text was updated successfully, but these errors were encountered: