Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix use of
//go
with Bzlmod by removing dependency on `@org_golang_…
…x_sys` (#3512) * Fix use of `//go` by exposing `@org_golang_x_sys` when using Bzlmod Running `bazel run //go` (or `bazel run @rules_go//go` from another module) fails when using Bzlmod because the `@org_golang_x_sys` repository is not visible. Without Bzlmod, the repository is loaded through a WORKSPACE dependency and the error does not happen. Two-step minimal reproduction from root of this repo: 1. `touch WORKSPACE.bzlmod` 2. `bazel run --enable_bzlmod //go` Here's the error that produces: ```shell $ bazel run --enable_bzlmod //go DEBUG: [email protected]/MODULE.bazel:7:6: WARNING: The bazel_gazelle Bazel module is still highly experimental and subject to change at any time. Only use it to try out bzlmod for now. WARNING: For repository 'com_google_protobuf', the root module requires module version [email protected], but got [email protected] in the resolved dependency graph. ERROR: /Users/brice/Documents/Code/rules_go/go/tools/go_bin_runner/BUILD.bazel:11:11: no such package '@[unknown repo 'org_golang_x_sys' requested from @]//unix': The repository '@[unknown repo 'org_golang_x_sys' requested from @]' could not be resolved: No repository visible as '@org_golang_x_sys' from main repository and referenced by '//go/tools/go_bin_runner:go_bin_runner_lib' ERROR: Analysis of target '//go:go' failed; build aborted: INFO: Elapsed time: 3.043s INFO: 0 processes. FAILED: Build did NOT complete successfully (45 packages loaded, 865 targets configured) currently loading: go/platform ERROR: Build failed. Not running target ``` Here's the point in the BUILD file where this repository is being referenced: https://github.com/bazelbuild/rules_go/blob/e558f56df9995f571e49de336c3831d407d9ff70/go/tools/go_bin_runner/BUILD.bazel#L25 * Remove `process_unix.go` and use `process.go` for all platforms. Eliminates dependency on `@org_golang_x_sys`. * Add Bzlmod test for //go --------- Co-authored-by: Fabian Meumertzheim <[email protected]>
- Loading branch information