gopackagesdriver: disable path mapping for GoStdlibList action#4585
Merged
fmeum merged 1 commit intoApr 7, 2026
Merged
Conversation
fmeum
approved these changes
Apr 7, 2026
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.
Since #4441, the
GoStdlibListaction usesSUPPORTS_PATH_MAPPING_REQUIREMENTand passes the cache directory viaadd_all(which enables path mapping). This causes the stdlib builder to write path-mapped directory names (e.g.bazel-out/cfg/) intostdlib.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:
Affected stdlib packages are those with CGO-compiled files (
net,os/user,internal/runtime/cgobench, etc.) whoseCompiledGoFilesreference gocache entries under the mapped path.Fix: Unlike the stdlib build action (
_build_stdlib), theGoStdlibListaction producesstdlib.pkg.jsonwhich 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 usingcache_dir.path(real filesystem path) and removeSUPPORTS_PATH_MAPPING_REQUIREMENTfrom this action only.This PR is an alternative to #4584 which tried to resolve this at the gopackagesdriver but that solution was deemed brittle.