gopackagesdriver: disable path mapping for GoStdlibList action (#4585)

Since https://github.com/bazel-contrib/rules_go/pull/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
https://github.com/bazel-contrib/rules_go/pull/4584 which tried to
resolve this at the gopackagesdriver but that solution was deemed
brittle.
1 file changed