Cleanup path-mapping enablement#4441
Merged
Merged
Conversation
fmeum
approved these changes
Sep 4, 2025
e5de2ad to
d3624c7
Compare
This was referenced Apr 7, 2026
fmeum
pushed a commit
that referenced
this pull request
Apr 7, 2026
Since #4441, the `GoStdlibList` action uses `SUPPORTS_PATH_MAPPING_REQUIREMENT` and passes the cache directory via `add_all` (which enables path mapping). This causes the stdlib builder to write path-mapped directory names (e.g. `bazel-out/cfg/`) into `stdlib.pkg.json`. The gopackagesdriver then reads these paths at runtime to open source files, but the mapped directory doesn't exist on disk — the actual files are under the real config directory (e.g. `bazel-out/k8-fastbuild/`). This breaks the gopackagesdriver for any Go target: ``` error: unable to resolve imports: open .../bazel-out/cfg/bin/external/io_bazel_rules_go/stdlib_/gocache/...: no such file or directory ``` Affected stdlib packages are those with CGO-compiled files (`net`, `os/user`, `internal/runtime/cgobench`, etc.) whose `CompiledGoFiles` reference gocache entries under the mapped path. **Fix:** Unlike the stdlib build action (`_build_stdlib`), the `GoStdlibList` action produces `stdlib.pkg.json` which is consumed at runtime by the gopackagesdriver — not by Bazel. Path mapping is not appropriate here because the mapped paths are never resolved back to real paths before being read. Revert to using `cache_dir.path` (real filesystem path) and remove `SUPPORTS_PATH_MAPPING_REQUIREMENT` from this action only. This PR is an alternative to #4584 which tried to resolve this at the gopackagesdriver but that solution was deemed brittle.
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.
What type of PR is this?
code cleanup
What does this PR do? Why is it needed?
This enables path-mapping for the GoInfo action and simplifies the
builder_args. As a side effect, we now set the-gorootflag for link actions but they do not yet opt into path mapping (and I don't think they will work yet, since they use .path on the archives)Which issues(s) does this PR fix?
Fixes #
Other notes for review