Skip to content

Conversation

bricedp
Copy link
Contributor

@bricedp bricedp commented Apr 2, 2023

What type of PR is this?

Bug fix

What does this PR do? Why is it needed?

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.

Related to these recent changes:

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:

$ bazel run --enable_bzlmod //go
DEBUG: gazelle@0.27.0/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 protobuf@3.19.2, but got protobuf@3.19.6 in the resolved dependency graph.
ERROR: /tmp/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

Which issues(s) does this PR fix?

None

Other notes for review

Thanks @fmeum for the test code!

bricedp and others added 4 commits March 31, 2023 19:06
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: gazelle@0.27.0/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 protobuf@3.19.2, but got protobuf@3.19.6 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
…inates dependency on `@org_golang_x_sys`.
@fmeum fmeum merged commit 941602a into bazel-contrib:master Apr 2, 2023
linzhp pushed a commit that referenced this pull request Apr 20, 2023
…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: gazelle@0.27.0/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 protobuf@3.19.2, but got protobuf@3.19.6 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 <fabian@meumertzhe.im>
renovate bot referenced this pull request in kreempuff/rules_unreal_engine Jun 22, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [io_bazel_rules_go](https://togithub.com/bazelbuild/rules_go) |
http_archive | minor | `v0.39.1` -> `v0.40.0` |

---

### ⚠ Dependency Lookup Warnings ⚠

Warnings were logged while processing this repo. Please check the
Dependency Dashboard for more information.

---

### Release Notes

<details>
<summary>bazelbuild/rules_go</summary>

###
[`v0.40.0`](https://togithub.com/bazelbuild/rules_go/releases/tag/v0.40.0)

[Compare
Source](https://togithub.com/bazelbuild/rules_go/compare/v0.39.1...v0.40.0)

#### What's Changed

- Revert "Add automatic platform detection from inbound crosstool_top a…
by [@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3468](https://togithub.com/bazelbuild/rules_go/pull/3468)
- bzlmod: Add dedicated documentation by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3519](https://togithub.com/bazelbuild/rules_go/pull/3519)
- Create TEST_SHARD_STATUS_FILE when sharding tests by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3547](https://togithub.com/bazelbuild/rules_go/pull/3547)
- Move CI flags to .bazelrc and fix BwoB build by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3551](https://togithub.com/bazelbuild/rules_go/pull/3551)
- Re-enable go_path_test on RBE by
[@&#8203;sluongng](https://togithub.com/sluongng) in
[https://github.com/bazelbuild/rules_go/pull/3539](https://togithub.com/bazelbuild/rules_go/pull/3539)
- nogo: provide usage doc by
[@&#8203;sluongng](https://togithub.com/sluongng) in
[https://github.com/bazelbuild/rules_go/pull/3534](https://togithub.com/bazelbuild/rules_go/pull/3534)
- respect global strip config by
[@&#8203;malt3](https://togithub.com/malt3) in
[https://github.com/bazelbuild/rules_go/pull/3527](https://togithub.com/bazelbuild/rules_go/pull/3527)
- stdliblist: return generated files by
[@&#8203;grampelberg](https://togithub.com/grampelberg) in
[https://github.com/bazelbuild/rules_go/pull/3552](https://togithub.com/bazelbuild/rules_go/pull/3552)
- Fix formatting in nogo usage doc by
[@&#8203;sluongng](https://togithub.com/sluongng) in
[https://github.com/bazelbuild/rules_go/pull/3557](https://togithub.com/bazelbuild/rules_go/pull/3557)
- Fix `goexperiment.*` build tags by
[@&#8203;lbcjbb](https://togithub.com/lbcjbb) in
[https://github.com/bazelbuild/rules_go/pull/3556](https://togithub.com/bazelbuild/rules_go/pull/3556)
- Remove tests for `go_path`'s `link` mode by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3565](https://togithub.com/bazelbuild/rules_go/pull/3565)
- Fix tests with `--incompatible_disable_starlark_host_transitions` by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3560](https://togithub.com/bazelbuild/rules_go/pull/3560)
- Create empty `.go` file in a random location by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3566](https://togithub.com/bazelbuild/rules_go/pull/3566)
- gopackagesdriver: fix interface to work with golangci-lint
([#&#8203;3523](https://togithub.com/bazelbuild/rules_go/issues/3523))
by [@&#8203;grampelberg](https://togithub.com/grampelberg) in
[https://github.com/bazelbuild/rules_go/pull/3524](https://togithub.com/bazelbuild/rules_go/pull/3524)
- Fix typo in load statement for bzlmod docs by
[@&#8203;Sovietaced](https://togithub.com/Sovietaced) in
[https://github.com/bazelbuild/rules_go/pull/3570](https://togithub.com/bazelbuild/rules_go/pull/3570)
- context: remove unused import by
[@&#8203;sluongng](https://togithub.com/sluongng) in
[https://github.com/bazelbuild/rules_go/pull/3571](https://togithub.com/bazelbuild/rules_go/pull/3571)
- docs: Mention `use_repo` automation by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3573](https://togithub.com/bazelbuild/rules_go/pull/3573)
- Test basic-gazelle example with incompatible flags by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3575](https://togithub.com/bazelbuild/rules_go/pull/3575)
- go_sdk extension: create `go_host_compatible_sdk` repository by
[@&#8203;ylecornec](https://togithub.com/ylecornec) in
[https://github.com/bazelbuild/rules_go/pull/3543](https://togithub.com/bazelbuild/rules_go/pull/3543)
- docs: Mention that `gazelle:prefix` can be replaced by `go.mod` by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3577](https://togithub.com/bazelbuild/rules_go/pull/3577)
- go_download_sdk: apply extraction workaround to zips on non-windows
OSs by [@&#8203;jayconrod](https://togithub.com/jayconrod) in
[https://github.com/bazelbuild/rules_go/pull/3563](https://togithub.com/bazelbuild/rules_go/pull/3563)
- Fix `go_download_sdk` with Bazel dev versions by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3580](https://togithub.com/bazelbuild/rules_go/pull/3580)
- Implement //nolint parsing similar to golangci-lint by
[@&#8203;patrickmscott](https://togithub.com/patrickmscott) in
[https://github.com/bazelbuild/rules_go/pull/3562](https://togithub.com/bazelbuild/rules_go/pull/3562)

#### New Contributors

- [@&#8203;bricedp](https://togithub.com/bricedp) made their first
contribution in
[https://github.com/bazelbuild/rules_go/pull/3512](https://togithub.com/bazelbuild/rules_go/pull/3512)
- [@&#8203;patrickmscott](https://togithub.com/patrickmscott) made their
first contribution in
[https://github.com/bazelbuild/rules_go/pull/3528](https://togithub.com/bazelbuild/rules_go/pull/3528)
- [@&#8203;grampelberg](https://togithub.com/grampelberg) made their
first contribution in
[https://github.com/bazelbuild/rules_go/pull/3552](https://togithub.com/bazelbuild/rules_go/pull/3552)
- [@&#8203;Sovietaced](https://togithub.com/Sovietaced) made their first
contribution in
[https://github.com/bazelbuild/rules_go/pull/3570](https://togithub.com/bazelbuild/rules_go/pull/3570)
- [@&#8203;ylecornec](https://togithub.com/ylecornec) made their first
contribution in
[https://github.com/bazelbuild/rules_go/pull/3543](https://togithub.com/bazelbuild/rules_go/pull/3543)

**Full Changelog**:
bazel-contrib/rules_go@v0.39.1...v0.40.0

#### `WORKSPACE` code

load("@&#8203;bazel_tools//tools/build_defs/repo:http.bzl",
"http_archive")

    http_archive(
        name = "io_bazel_rules_go",
sha256 =
"bfc5ce70b9d1634ae54f4e7b495657a18a04e0d596785f672d35d5f505ab491a",
        urls = [

"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.40.0/rules_go-v0.40.0.zip",

"https://github.com/bazelbuild/rules_go/releases/download/v0.40.0/rules_go-v0.40.0.zip",
        ],
    )

load("@&#8203;io_bazel_rules_go//go:deps.bzl", "go_register_toolchains",
"go_rules_dependencies")

    go_rules_dependencies()

    go_register_toolchains(version = "1.20.5")

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/kreempuff/rules_unreal_engine).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4xMzEuMCIsInVwZGF0ZWRJblZlciI6IjM1LjEzMS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->
renovate bot referenced this pull request in cgrindel/rules_swift_package_manager Jun 23, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [io_bazel_rules_go](https://togithub.com/bazelbuild/rules_go) |
http_archive | minor | `v0.39.1` -> `v0.40.0` |

---

### Release Notes

<details>
<summary>bazelbuild/rules_go</summary>

###
[`v0.40.0`](https://togithub.com/bazelbuild/rules_go/releases/tag/v0.40.0)

[Compare
Source](https://togithub.com/bazelbuild/rules_go/compare/v0.39.1...v0.40.0)

#### What's Changed

- Revert "Add automatic platform detection from inbound crosstool_top a…
by [@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3468](https://togithub.com/bazelbuild/rules_go/pull/3468)
- bzlmod: Add dedicated documentation by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3519](https://togithub.com/bazelbuild/rules_go/pull/3519)
- Create TEST_SHARD_STATUS_FILE when sharding tests by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3547](https://togithub.com/bazelbuild/rules_go/pull/3547)
- Move CI flags to .bazelrc and fix BwoB build by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3551](https://togithub.com/bazelbuild/rules_go/pull/3551)
- Re-enable go_path_test on RBE by
[@&#8203;sluongng](https://togithub.com/sluongng) in
[https://github.com/bazelbuild/rules_go/pull/3539](https://togithub.com/bazelbuild/rules_go/pull/3539)
- nogo: provide usage doc by
[@&#8203;sluongng](https://togithub.com/sluongng) in
[https://github.com/bazelbuild/rules_go/pull/3534](https://togithub.com/bazelbuild/rules_go/pull/3534)
- respect global strip config by
[@&#8203;malt3](https://togithub.com/malt3) in
[https://github.com/bazelbuild/rules_go/pull/3527](https://togithub.com/bazelbuild/rules_go/pull/3527)
- stdliblist: return generated files by
[@&#8203;grampelberg](https://togithub.com/grampelberg) in
[https://github.com/bazelbuild/rules_go/pull/3552](https://togithub.com/bazelbuild/rules_go/pull/3552)
- Fix formatting in nogo usage doc by
[@&#8203;sluongng](https://togithub.com/sluongng) in
[https://github.com/bazelbuild/rules_go/pull/3557](https://togithub.com/bazelbuild/rules_go/pull/3557)
- Fix `goexperiment.*` build tags by
[@&#8203;lbcjbb](https://togithub.com/lbcjbb) in
[https://github.com/bazelbuild/rules_go/pull/3556](https://togithub.com/bazelbuild/rules_go/pull/3556)
- Remove tests for `go_path`'s `link` mode by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3565](https://togithub.com/bazelbuild/rules_go/pull/3565)
- Fix tests with `--incompatible_disable_starlark_host_transitions` by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3560](https://togithub.com/bazelbuild/rules_go/pull/3560)
- Create empty `.go` file in a random location by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3566](https://togithub.com/bazelbuild/rules_go/pull/3566)
- gopackagesdriver: fix interface to work with golangci-lint
([#&#8203;3523](https://togithub.com/bazelbuild/rules_go/issues/3523))
by [@&#8203;grampelberg](https://togithub.com/grampelberg) in
[https://github.com/bazelbuild/rules_go/pull/3524](https://togithub.com/bazelbuild/rules_go/pull/3524)
- Fix typo in load statement for bzlmod docs by
[@&#8203;Sovietaced](https://togithub.com/Sovietaced) in
[https://github.com/bazelbuild/rules_go/pull/3570](https://togithub.com/bazelbuild/rules_go/pull/3570)
- context: remove unused import by
[@&#8203;sluongng](https://togithub.com/sluongng) in
[https://github.com/bazelbuild/rules_go/pull/3571](https://togithub.com/bazelbuild/rules_go/pull/3571)
- docs: Mention `use_repo` automation by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3573](https://togithub.com/bazelbuild/rules_go/pull/3573)
- Test basic-gazelle example with incompatible flags by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3575](https://togithub.com/bazelbuild/rules_go/pull/3575)
- go_sdk extension: create `go_host_compatible_sdk` repository by
[@&#8203;ylecornec](https://togithub.com/ylecornec) in
[https://github.com/bazelbuild/rules_go/pull/3543](https://togithub.com/bazelbuild/rules_go/pull/3543)
- docs: Mention that `gazelle:prefix` can be replaced by `go.mod` by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3577](https://togithub.com/bazelbuild/rules_go/pull/3577)
- go_download_sdk: apply extraction workaround to zips on non-windows
OSs by [@&#8203;jayconrod](https://togithub.com/jayconrod) in
[https://github.com/bazelbuild/rules_go/pull/3563](https://togithub.com/bazelbuild/rules_go/pull/3563)
- Fix `go_download_sdk` with Bazel dev versions by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3580](https://togithub.com/bazelbuild/rules_go/pull/3580)
- Implement //nolint parsing similar to golangci-lint by
[@&#8203;patrickmscott](https://togithub.com/patrickmscott) in
[https://github.com/bazelbuild/rules_go/pull/3562](https://togithub.com/bazelbuild/rules_go/pull/3562)

#### New Contributors

- [@&#8203;bricedp](https://togithub.com/bricedp) made their first
contribution in
[https://github.com/bazelbuild/rules_go/pull/3512](https://togithub.com/bazelbuild/rules_go/pull/3512)
- [@&#8203;patrickmscott](https://togithub.com/patrickmscott) made their
first contribution in
[https://github.com/bazelbuild/rules_go/pull/3528](https://togithub.com/bazelbuild/rules_go/pull/3528)
- [@&#8203;grampelberg](https://togithub.com/grampelberg) made their
first contribution in
[https://github.com/bazelbuild/rules_go/pull/3552](https://togithub.com/bazelbuild/rules_go/pull/3552)
- [@&#8203;Sovietaced](https://togithub.com/Sovietaced) made their first
contribution in
[https://github.com/bazelbuild/rules_go/pull/3570](https://togithub.com/bazelbuild/rules_go/pull/3570)
- [@&#8203;ylecornec](https://togithub.com/ylecornec) made their first
contribution in
[https://github.com/bazelbuild/rules_go/pull/3543](https://togithub.com/bazelbuild/rules_go/pull/3543)

**Full Changelog**:
bazel-contrib/rules_go@v0.39.1...v0.40.0

#### `WORKSPACE` code

load("@&#8203;bazel_tools//tools/build_defs/repo:http.bzl",
"http_archive")

    http_archive(
        name = "io_bazel_rules_go",
sha256 =
"bfc5ce70b9d1634ae54f4e7b495657a18a04e0d596785f672d35d5f505ab491a",
        urls = [

"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.40.0/rules_go-v0.40.0.zip",

"https://github.com/bazelbuild/rules_go/releases/download/v0.40.0/rules_go-v0.40.0.zip",
        ],
    )

load("@&#8203;io_bazel_rules_go//go:deps.bzl", "go_register_toolchains",
"go_rules_dependencies")

    go_rules_dependencies()

    go_register_toolchains(version = "1.20.5")

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/cgrindel/rules_swift_package_manager).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4xMzEuMCIsInVwZGF0ZWRJblZlciI6IjM1LjEzMS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
renovate bot referenced this pull request in cgrindel/bazel-starlib Jun 23, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [io_bazel_rules_go](https://togithub.com/bazelbuild/rules_go) |
http_archive | minor | `v0.39.1` -> `v0.40.0` |

---

### Release Notes

<details>
<summary>bazelbuild/rules_go</summary>

###
[`v0.40.0`](https://togithub.com/bazelbuild/rules_go/releases/tag/v0.40.0)

[Compare
Source](https://togithub.com/bazelbuild/rules_go/compare/v0.39.1...v0.40.0)

#### What's Changed

- Revert "Add automatic platform detection from inbound crosstool_top a…
by [@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3468](https://togithub.com/bazelbuild/rules_go/pull/3468)
- bzlmod: Add dedicated documentation by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3519](https://togithub.com/bazelbuild/rules_go/pull/3519)
- Create TEST_SHARD_STATUS_FILE when sharding tests by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3547](https://togithub.com/bazelbuild/rules_go/pull/3547)
- Move CI flags to .bazelrc and fix BwoB build by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3551](https://togithub.com/bazelbuild/rules_go/pull/3551)
- Re-enable go_path_test on RBE by
[@&#8203;sluongng](https://togithub.com/sluongng) in
[https://github.com/bazelbuild/rules_go/pull/3539](https://togithub.com/bazelbuild/rules_go/pull/3539)
- nogo: provide usage doc by
[@&#8203;sluongng](https://togithub.com/sluongng) in
[https://github.com/bazelbuild/rules_go/pull/3534](https://togithub.com/bazelbuild/rules_go/pull/3534)
- respect global strip config by
[@&#8203;malt3](https://togithub.com/malt3) in
[https://github.com/bazelbuild/rules_go/pull/3527](https://togithub.com/bazelbuild/rules_go/pull/3527)
- stdliblist: return generated files by
[@&#8203;grampelberg](https://togithub.com/grampelberg) in
[https://github.com/bazelbuild/rules_go/pull/3552](https://togithub.com/bazelbuild/rules_go/pull/3552)
- Fix formatting in nogo usage doc by
[@&#8203;sluongng](https://togithub.com/sluongng) in
[https://github.com/bazelbuild/rules_go/pull/3557](https://togithub.com/bazelbuild/rules_go/pull/3557)
- Fix `goexperiment.*` build tags by
[@&#8203;lbcjbb](https://togithub.com/lbcjbb) in
[https://github.com/bazelbuild/rules_go/pull/3556](https://togithub.com/bazelbuild/rules_go/pull/3556)
- Remove tests for `go_path`'s `link` mode by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3565](https://togithub.com/bazelbuild/rules_go/pull/3565)
- Fix tests with `--incompatible_disable_starlark_host_transitions` by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3560](https://togithub.com/bazelbuild/rules_go/pull/3560)
- Create empty `.go` file in a random location by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3566](https://togithub.com/bazelbuild/rules_go/pull/3566)
- gopackagesdriver: fix interface to work with golangci-lint
([#&#8203;3523](https://togithub.com/bazelbuild/rules_go/issues/3523))
by [@&#8203;grampelberg](https://togithub.com/grampelberg) in
[https://github.com/bazelbuild/rules_go/pull/3524](https://togithub.com/bazelbuild/rules_go/pull/3524)
- Fix typo in load statement for bzlmod docs by
[@&#8203;Sovietaced](https://togithub.com/Sovietaced) in
[https://github.com/bazelbuild/rules_go/pull/3570](https://togithub.com/bazelbuild/rules_go/pull/3570)
- context: remove unused import by
[@&#8203;sluongng](https://togithub.com/sluongng) in
[https://github.com/bazelbuild/rules_go/pull/3571](https://togithub.com/bazelbuild/rules_go/pull/3571)
- docs: Mention `use_repo` automation by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3573](https://togithub.com/bazelbuild/rules_go/pull/3573)
- Test basic-gazelle example with incompatible flags by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3575](https://togithub.com/bazelbuild/rules_go/pull/3575)
- go_sdk extension: create `go_host_compatible_sdk` repository by
[@&#8203;ylecornec](https://togithub.com/ylecornec) in
[https://github.com/bazelbuild/rules_go/pull/3543](https://togithub.com/bazelbuild/rules_go/pull/3543)
- docs: Mention that `gazelle:prefix` can be replaced by `go.mod` by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3577](https://togithub.com/bazelbuild/rules_go/pull/3577)
- go_download_sdk: apply extraction workaround to zips on non-windows
OSs by [@&#8203;jayconrod](https://togithub.com/jayconrod) in
[https://github.com/bazelbuild/rules_go/pull/3563](https://togithub.com/bazelbuild/rules_go/pull/3563)
- Fix `go_download_sdk` with Bazel dev versions by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3580](https://togithub.com/bazelbuild/rules_go/pull/3580)
- Implement //nolint parsing similar to golangci-lint by
[@&#8203;patrickmscott](https://togithub.com/patrickmscott) in
[https://github.com/bazelbuild/rules_go/pull/3562](https://togithub.com/bazelbuild/rules_go/pull/3562)

#### New Contributors

- [@&#8203;bricedp](https://togithub.com/bricedp) made their first
contribution in
[https://github.com/bazelbuild/rules_go/pull/3512](https://togithub.com/bazelbuild/rules_go/pull/3512)
- [@&#8203;patrickmscott](https://togithub.com/patrickmscott) made their
first contribution in
[https://github.com/bazelbuild/rules_go/pull/3528](https://togithub.com/bazelbuild/rules_go/pull/3528)
- [@&#8203;grampelberg](https://togithub.com/grampelberg) made their
first contribution in
[https://github.com/bazelbuild/rules_go/pull/3552](https://togithub.com/bazelbuild/rules_go/pull/3552)
- [@&#8203;Sovietaced](https://togithub.com/Sovietaced) made their first
contribution in
[https://github.com/bazelbuild/rules_go/pull/3570](https://togithub.com/bazelbuild/rules_go/pull/3570)
- [@&#8203;ylecornec](https://togithub.com/ylecornec) made their first
contribution in
[https://github.com/bazelbuild/rules_go/pull/3543](https://togithub.com/bazelbuild/rules_go/pull/3543)

**Full Changelog**:
bazel-contrib/rules_go@v0.39.1...v0.40.0

#### `WORKSPACE` code

load("@&#8203;bazel_tools//tools/build_defs/repo:http.bzl",
"http_archive")

    http_archive(
        name = "io_bazel_rules_go",
sha256 =
"bfc5ce70b9d1634ae54f4e7b495657a18a04e0d596785f672d35d5f505ab491a",
        urls = [

"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.40.0/rules_go-v0.40.0.zip",

"https://github.com/bazelbuild/rules_go/releases/download/v0.40.0/rules_go-v0.40.0.zip",
        ],
    )

load("@&#8203;io_bazel_rules_go//go:deps.bzl", "go_register_toolchains",
"go_rules_dependencies")

    go_rules_dependencies()

    go_register_toolchains(version = "1.20.5")

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/cgrindel/bazel-starlib).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4xMzEuMCIsInVwZGF0ZWRJblZlciI6IjM1LjEzMS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
tingilee pushed a commit to tingilee/rules_go that referenced this pull request Jul 19, 2023
…x_sys` (bazel-contrib#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: gazelle@0.27.0/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 protobuf@3.19.2, but got protobuf@3.19.6 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 <fabian@meumertzhe.im>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants