Repository navigation
Conversation
The wrapper wrote the rewritten files to a new os.MkdirTemp directory under the go command's work directory. The compiler records file names in the export data, and the go command trims only the compile's own object directory, so every build of a rewritten package produced a different archive, with a random absolute path in it. That fails builds where the go command compiles a package twice with the same inputs. With PGO, go test can compile a dependency once for each test binary that needs it, then compile an importer against one copy and link the other. In github.com/thesyncim/goav1, whose cmd/qualitybench has a default.pgo, go test ./... fails with: link: fingerprint mismatch: github.com/thesyncim/goav1 has 9bcecb47ca806e38, import from github.com/thesyncim/goav1/cmd/qualitybench expecting 224b81cee36e8b4e The rewritten files now go in a loopvec directory inside the object directory, next to the importcfg the go command writes there. That is still a separate place for each compile, and the -trimpath the go command passes reduces it to loopvec/x.go.
thesyncim
force-pushed
the
toolexec-reproducible
branch
from
November 1, 2026 13:36
6a5db5b to
0eb9b61
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The wrapper wrote rewritten files to a fresh
os.MkdirTempdirectory under the go command's work directory. File names end up in the export data, and the go command only trims each compile's own object directory. So every build of a rewritten package gave a different archive, with a random absolute path in it.That breaks builds where the go command compiles one package twice with the same inputs. With PGO,
go testcan compile a dependency once per test binary, then compile an importer against one copy and link the other. In goav1, whosecmd/qualitybenchhas adefault.pgo,go test ./...failed with master's wrapper:The rewritten files now go in
loopvec/inside the object directory, next to the importcfg the go command writes there. That's still a separate place for each compile, and the-trimpath "$WORK/bNNN=>"that the go command always passes reduces it toloopvec/x.go. After this, the two archives in that build have the same content ID, and the test binary links.toolexec_reproducible.txtbuilds a package with two empty caches and compares the archives. It fails without the change.-trimpathbuilds were already fine.