Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to modern protoc plugins #3761

Merged
merged 4 commits into from
Dec 14, 2023

Conversation

mering
Copy link
Contributor

@mering mering commented Nov 21, 2023

What type of PR is this?

Update

What does this PR do? Why is it needed?

The module github.com/golang/protobuf has been superseded by the google.golang.org/protobuf and google.golang.org/grpc modules, which contain an updated and simplified API, support for protobuf reflection, and many other improvements.

The go_grpc_library() macro maintains the current behavior of generating both the proto and the service definitions.

Which issues(s) does this PR fix?

Fixes #3022

Supercedes #3437, #3783

Other notes for review

@mering mering force-pushed the update-protoc-plugins branch 25 times, most recently from 2a2c76c to 7114512 Compare November 24, 2023 09:12
@mering
Copy link
Contributor Author

mering commented Nov 24, 2023

@fmeum There is a BCR build failure:

ERROR: C:/b/bxkbc7u6/external/rules_go~override/proto/BUILD.bazel:31:18: no such package '@gazelle~0.34.0~go_deps~org_golang_google_grpc//cmd/protoc-gen-go-grpc': BUILD file not found in directory 'cmd/protoc-gen-go-grpc' of external repository @gazelle~0.34.0~go_deps~org_golang_google_grpc. Add a BUILD file to a directory to mark it as a package. and referenced by '@rules_go~override//proto:go_grpc_reset_plugin_'

Do I see it correctly that this is because the bzlmod dependency doesn't have build_file_generation = "on" set which can only be corrected by an upstream PR to Gazelle like bazel-contrib/bazel-gazelle#1672?

@mering mering force-pushed the update-protoc-plugins branch 4 times, most recently from 3fa61e5 to 04cb3b6 Compare November 24, 2023 11:27
@fmeum
Copy link
Member

fmeum commented Dec 13, 2023

I pushed a commit with the required releaser changes.

@mering
Copy link
Contributor Author

mering commented Dec 13, 2023

I pushed a commit with the required releaser changes.

Awesome, thanks a lot!

@fmeum fmeum enabled auto-merge (squash) December 14, 2023 07:36
@fmeum fmeum merged commit 5df0c5e into bazel-contrib:master Dec 14, 2023
2 checks passed
@mering mering deleted the update-protoc-plugins branch December 14, 2023 09:24
@ryanpbrewster
Copy link
Contributor

@fmeum do you think we can get a fresh release out with this protoc plugin? Would be nice to give folks a chance to start trying it out.

@fmeum
Copy link
Member

fmeum commented Dec 19, 2023

#3788

cgrindel-self-hosted-renovate bot referenced this pull request in cgrindel/bazel-starlib Dec 19, 2023
This PR contains the following updates:

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

---

### Release Notes

<details>
<summary>bazelbuild/rules_go (io_bazel_rules_go)</summary>

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

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

### IMPORTANT CHANGES

#### Tests now call `panic()` when they timeout

This means there is a running goroutine (which will fail
[goleak](https://togithub.com/uber-go/goleak) detection)

[Goroutine 26 in state chan receive, with
github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1
on top of the

This also means there may be some different behavior when calling
`SIGTERM` directly from within a test.

For more information see:
[https://github.com/bazelbuild/rules_go/pull/3749](https://togithub.com/bazelbuild/rules_go/pull/3749)

#### Bzlmod support for `nogo`

This can be added in your `MODULE.bazel` file:

go_sdk = use_extension("@&#8203;io_bazel_rules_go//go:extensions.bzl",
"go_sdk")
    go_sdk.download(
        name = "go_sdk",
        ...
    )
    go_sdk.nogo(
        nogo = "//:default_nogo",
    )

For more information see
[https://github.com/bazelbuild/rules_go/pull/3782](https://togithub.com/bazelbuild/rules_go/pull/3782)

#### `WORKSPACE` code

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

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

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

"https://github.com/bazelbuild/rules_go/releases/download/v0.44.0/rules_go-v0.44.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.21.5")

#### What's Changed

- Do not test on centos7 by [@&#8203;fmeum](https://togithub.com/fmeum)
in
[https://github.com/bazelbuild/rules_go/pull/3757](https://togithub.com/bazelbuild/rules_go/pull/3757)
- update documentation for 0.43.0 release by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[https://github.com/bazelbuild/rules_go/pull/3758](https://togithub.com/bazelbuild/rules_go/pull/3758)
- Add toolchain param to affected actions by
[@&#8203;kotlaja](https://togithub.com/kotlaja) in
[https://github.com/bazelbuild/rules_go/pull/3760](https://togithub.com/bazelbuild/rules_go/pull/3760)
- Update GO_TOOLCHAIN string to Label and add toolchain param to one
more action by [@&#8203;kotlaja](https://togithub.com/kotlaja) in
[https://github.com/bazelbuild/rules_go/pull/3762](https://togithub.com/bazelbuild/rules_go/pull/3762)
- Do not choose prereleases as highest versions by
[@&#8203;mering](https://togithub.com/mering) in
[https://github.com/bazelbuild/rules_go/pull/3764](https://togithub.com/bazelbuild/rules_go/pull/3764)
- Remove unmaintained validators by
[@&#8203;mering](https://togithub.com/mering) in
[https://github.com/bazelbuild/rules_go/pull/3768](https://togithub.com/bazelbuild/rules_go/pull/3768)
- Use `tools.go` trick to make `go.mod` work with `go mod tidy` by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3775](https://togithub.com/bazelbuild/rules_go/pull/3775)
- feat(packagesdriver): add \_test suffix to pkgPath by
[@&#8203;JamyDev](https://togithub.com/JamyDev) in
[https://github.com/bazelbuild/rules_go/pull/3777](https://togithub.com/bazelbuild/rules_go/pull/3777)
- Typo --test_runner_fail_fast by
[@&#8203;Clement-Jean](https://togithub.com/Clement-Jean) in
[https://github.com/bazelbuild/rules_go/pull/3773](https://togithub.com/bazelbuild/rules_go/pull/3773)
- Panic when a test times out by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3749](https://togithub.com/bazelbuild/rules_go/pull/3749)
- Fix integration tests with Bazel@HEAD by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3781](https://togithub.com/bazelbuild/rules_go/pull/3781)
- Automatically register SDKs for common execution platforms by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3634](https://togithub.com/bazelbuild/rules_go/pull/3634)
- fix `aux_files` relative paths for gomock source mocks (fix
[#&#8203;3752](https://togithub.com/bazelbuild/rules_go/issues/3752)) by
[@&#8203;ikavalio](https://togithub.com/ikavalio) in
[https://github.com/bazelbuild/rules_go/pull/3753](https://togithub.com/bazelbuild/rules_go/pull/3753)
- Update to modern protoc plugins by
[@&#8203;mering](https://togithub.com/mering) in
[https://github.com/bazelbuild/rules_go/pull/3761](https://togithub.com/bazelbuild/rules_go/pull/3761)
- Add integration tests for protoc-gen-go-grpc by
[@&#8203;ryanpbrewster](https://togithub.com/ryanpbrewster) in
[https://github.com/bazelbuild/rules_go/pull/3787](https://togithub.com/bazelbuild/rules_go/pull/3787)
- Add Bzlmod support for `nogo` by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3782](https://togithub.com/bazelbuild/rules_go/pull/3782)
- fix(gpd): don't panic on invalid root by
[@&#8203;JamyDev](https://togithub.com/JamyDev) in
[https://github.com/bazelbuild/rules_go/pull/3779](https://togithub.com/bazelbuild/rules_go/pull/3779)
- Pass env to gentestmain so it will correctly filter by
[@&#8203;patrickmscott](https://togithub.com/patrickmscott) in
[https://github.com/bazelbuild/rules_go/pull/3785](https://togithub.com/bazelbuild/rules_go/pull/3785)
- prepare release 0.44.0 by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[https://github.com/bazelbuild/rules_go/pull/3788](https://togithub.com/bazelbuild/rules_go/pull/3788)

#### New Contributors

- [@&#8203;Clement-Jean](https://togithub.com/Clement-Jean) made their
first contribution in
[https://github.com/bazelbuild/rules_go/pull/3773](https://togithub.com/bazelbuild/rules_go/pull/3773)
- [@&#8203;ikavalio](https://togithub.com/ikavalio) made their first
contribution in
[https://github.com/bazelbuild/rules_go/pull/3753](https://togithub.com/bazelbuild/rules_go/pull/3753)
- [@&#8203;ryanpbrewster](https://togithub.com/ryanpbrewster) made their
first contribution in
[https://github.com/bazelbuild/rules_go/pull/3787](https://togithub.com/bazelbuild/rules_go/pull/3787)

**Full Changelog**:
bazel-contrib/rules_go@v0.43.0...v0.44.0

</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.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

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

---

This PR has been generated by [Renovate
Bot](https://togithub.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMDAuMCIsInVwZGF0ZWRJblZlciI6IjM2LjEwMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: Self-hosted Renovate Bot <361546+cgrindel-self-hosted-renovate[bot]@users.noreply.github.enterprise.com>
renovate bot referenced this pull request in kreempuff/rules_unreal_engine Dec 19, 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.43.0` -> `v0.44.0` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>bazelbuild/rules_go (io_bazel_rules_go)</summary>

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

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

### IMPORTANT CHANGES

#### Tests now call `panic()` when they timeout

This means there is a running goroutine (which will fail
[goleak](https://togithub.com/uber-go/goleak) detection)

[Goroutine 26 in state chan receive, with
github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1
on top of the

This also means there may be some different behavior when calling
`SIGTERM` directly from within a test.

For more information see:
[https://github.com/bazelbuild/rules_go/pull/3749](https://togithub.com/bazelbuild/rules_go/pull/3749)

#### Bzlmod support for `nogo`

This can be added in your `MODULE.bazel` file:

go_sdk = use_extension("@&#8203;io_bazel_rules_go//go:extensions.bzl",
"go_sdk")
    go_sdk.download(
        name = "go_sdk",
        ...
    )
    go_sdk.nogo(
        nogo = "//:default_nogo",
    )

For more information see
[https://github.com/bazelbuild/rules_go/pull/3782](https://togithub.com/bazelbuild/rules_go/pull/3782)

#### `WORKSPACE` code

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

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

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

"https://github.com/bazelbuild/rules_go/releases/download/v0.44.0/rules_go-v0.44.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.21.5")

#### What's Changed

- Do not test on centos7 by [@&#8203;fmeum](https://togithub.com/fmeum)
in
[https://github.com/bazelbuild/rules_go/pull/3757](https://togithub.com/bazelbuild/rules_go/pull/3757)
- update documentation for 0.43.0 release by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[https://github.com/bazelbuild/rules_go/pull/3758](https://togithub.com/bazelbuild/rules_go/pull/3758)
- Add toolchain param to affected actions by
[@&#8203;kotlaja](https://togithub.com/kotlaja) in
[https://github.com/bazelbuild/rules_go/pull/3760](https://togithub.com/bazelbuild/rules_go/pull/3760)
- Update GO_TOOLCHAIN string to Label and add toolchain param to one
more action by [@&#8203;kotlaja](https://togithub.com/kotlaja) in
[https://github.com/bazelbuild/rules_go/pull/3762](https://togithub.com/bazelbuild/rules_go/pull/3762)
- Do not choose prereleases as highest versions by
[@&#8203;mering](https://togithub.com/mering) in
[https://github.com/bazelbuild/rules_go/pull/3764](https://togithub.com/bazelbuild/rules_go/pull/3764)
- Remove unmaintained validators by
[@&#8203;mering](https://togithub.com/mering) in
[https://github.com/bazelbuild/rules_go/pull/3768](https://togithub.com/bazelbuild/rules_go/pull/3768)
- Use `tools.go` trick to make `go.mod` work with `go mod tidy` by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3775](https://togithub.com/bazelbuild/rules_go/pull/3775)
- feat(packagesdriver): add \_test suffix to pkgPath by
[@&#8203;JamyDev](https://togithub.com/JamyDev) in
[https://github.com/bazelbuild/rules_go/pull/3777](https://togithub.com/bazelbuild/rules_go/pull/3777)
- Typo --test_runner_fail_fast by
[@&#8203;Clement-Jean](https://togithub.com/Clement-Jean) in
[https://github.com/bazelbuild/rules_go/pull/3773](https://togithub.com/bazelbuild/rules_go/pull/3773)
- Panic when a test times out by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3749](https://togithub.com/bazelbuild/rules_go/pull/3749)
- Fix integration tests with Bazel@HEAD by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3781](https://togithub.com/bazelbuild/rules_go/pull/3781)
- Automatically register SDKs for common execution platforms by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3634](https://togithub.com/bazelbuild/rules_go/pull/3634)
- fix `aux_files` relative paths for gomock source mocks (fix
[#&#8203;3752](https://togithub.com/bazelbuild/rules_go/issues/3752)) by
[@&#8203;ikavalio](https://togithub.com/ikavalio) in
[https://github.com/bazelbuild/rules_go/pull/3753](https://togithub.com/bazelbuild/rules_go/pull/3753)
- Update to modern protoc plugins by
[@&#8203;mering](https://togithub.com/mering) in
[https://github.com/bazelbuild/rules_go/pull/3761](https://togithub.com/bazelbuild/rules_go/pull/3761)
- Add integration tests for protoc-gen-go-grpc by
[@&#8203;ryanpbrewster](https://togithub.com/ryanpbrewster) in
[https://github.com/bazelbuild/rules_go/pull/3787](https://togithub.com/bazelbuild/rules_go/pull/3787)
- Add Bzlmod support for `nogo` by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3782](https://togithub.com/bazelbuild/rules_go/pull/3782)
- fix(gpd): don't panic on invalid root by
[@&#8203;JamyDev](https://togithub.com/JamyDev) in
[https://github.com/bazelbuild/rules_go/pull/3779](https://togithub.com/bazelbuild/rules_go/pull/3779)
- Pass env to gentestmain so it will correctly filter by
[@&#8203;patrickmscott](https://togithub.com/patrickmscott) in
[https://github.com/bazelbuild/rules_go/pull/3785](https://togithub.com/bazelbuild/rules_go/pull/3785)
- prepare release 0.44.0 by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[https://github.com/bazelbuild/rules_go/pull/3788](https://togithub.com/bazelbuild/rules_go/pull/3788)

#### New Contributors

- [@&#8203;Clement-Jean](https://togithub.com/Clement-Jean) made their
first contribution in
[https://github.com/bazelbuild/rules_go/pull/3773](https://togithub.com/bazelbuild/rules_go/pull/3773)
- [@&#8203;ikavalio](https://togithub.com/ikavalio) made their first
contribution in
[https://github.com/bazelbuild/rules_go/pull/3753](https://togithub.com/bazelbuild/rules_go/pull/3753)
- [@&#8203;ryanpbrewster](https://togithub.com/ryanpbrewster) made their
first contribution in
[https://github.com/bazelbuild/rules_go/pull/3787](https://togithub.com/bazelbuild/rules_go/pull/3787)

**Full Changelog**:
bazel-contrib/rules_go@v0.43.0...v0.44.0

</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:eyJjcmVhdGVkSW5WZXIiOiIzNy4xMDMuMSIsInVwZGF0ZWRJblZlciI6IjM3LjEwMy4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->
def go_grpc_library(**kwargs):
# TODO: Deprecate once gazelle generates just go_proto_library
go_proto_library(compilers = [Label("//proto:go_grpc")], **kwargs)
def go_grpc_library(name, **kwargs):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this support passing in additional values for compilers for things like @com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-grpc-gateway:go_gen_grpc_gateway?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For custom scenarios I think you can always "drop down" to the lower-level go_proto_library and pass in whatever compilers you want. IMO this method is mostly a matter of convenience for the 90% of use-cases that want these two specific compilers.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ya totally fair, I only bring it up because the deprecation notice says via go_grpc_library() rule which didn't end up working for us since we use grpc-gateway, so maybe the deprecation message could mention both options to clear up any confusion

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems entirely reasonable

ryanpbrewster added a commit to ryanpbrewster/rules_go that referenced this pull request Dec 20, 2023
fmeum pushed a commit that referenced this pull request Dec 20, 2023
cgrindel-self-hosted-renovate bot referenced this pull request in cgrindel/rules_swift_package_manager Dec 20, 2023
This PR contains the following updates:

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

---

### Release Notes

<details>
<summary>bazelbuild/rules_go (io_bazel_rules_go)</summary>

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

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

### IMPORTANT CHANGES

#### Tests now call `panic()` when they timeout

This means there is a running goroutine (which will fail
[goleak](https://togithub.com/uber-go/goleak) detection)

[Goroutine 26 in state chan receive, with
github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1
on top of the

This also means there may be some different behavior when calling
`SIGTERM` directly from within a test.

For more information see:
[https://github.com/bazelbuild/rules_go/pull/3749](https://togithub.com/bazelbuild/rules_go/pull/3749)

#### Bzlmod support for `nogo`

This can be added in your `MODULE.bazel` file:

go_sdk = use_extension("@&#8203;io_bazel_rules_go//go:extensions.bzl",
"go_sdk")
    go_sdk.download(
        name = "go_sdk",
        ...
    )
    go_sdk.nogo(
        nogo = "//:default_nogo",
    )

For more information see
[https://github.com/bazelbuild/rules_go/pull/3782](https://togithub.com/bazelbuild/rules_go/pull/3782)

#### `WORKSPACE` code

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

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

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

"https://github.com/bazelbuild/rules_go/releases/download/v0.44.0/rules_go-v0.44.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.21.5")

#### What's Changed

- Do not test on centos7 by [@&#8203;fmeum](https://togithub.com/fmeum)
in
[https://github.com/bazelbuild/rules_go/pull/3757](https://togithub.com/bazelbuild/rules_go/pull/3757)
- update documentation for 0.43.0 release by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[https://github.com/bazelbuild/rules_go/pull/3758](https://togithub.com/bazelbuild/rules_go/pull/3758)
- Add toolchain param to affected actions by
[@&#8203;kotlaja](https://togithub.com/kotlaja) in
[https://github.com/bazelbuild/rules_go/pull/3760](https://togithub.com/bazelbuild/rules_go/pull/3760)
- Update GO_TOOLCHAIN string to Label and add toolchain param to one
more action by [@&#8203;kotlaja](https://togithub.com/kotlaja) in
[https://github.com/bazelbuild/rules_go/pull/3762](https://togithub.com/bazelbuild/rules_go/pull/3762)
- Do not choose prereleases as highest versions by
[@&#8203;mering](https://togithub.com/mering) in
[https://github.com/bazelbuild/rules_go/pull/3764](https://togithub.com/bazelbuild/rules_go/pull/3764)
- Remove unmaintained validators by
[@&#8203;mering](https://togithub.com/mering) in
[https://github.com/bazelbuild/rules_go/pull/3768](https://togithub.com/bazelbuild/rules_go/pull/3768)
- Use `tools.go` trick to make `go.mod` work with `go mod tidy` by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3775](https://togithub.com/bazelbuild/rules_go/pull/3775)
- feat(packagesdriver): add \_test suffix to pkgPath by
[@&#8203;JamyDev](https://togithub.com/JamyDev) in
[https://github.com/bazelbuild/rules_go/pull/3777](https://togithub.com/bazelbuild/rules_go/pull/3777)
- Typo --test_runner_fail_fast by
[@&#8203;Clement-Jean](https://togithub.com/Clement-Jean) in
[https://github.com/bazelbuild/rules_go/pull/3773](https://togithub.com/bazelbuild/rules_go/pull/3773)
- Panic when a test times out by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3749](https://togithub.com/bazelbuild/rules_go/pull/3749)
- Fix integration tests with Bazel@HEAD by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3781](https://togithub.com/bazelbuild/rules_go/pull/3781)
- Automatically register SDKs for common execution platforms by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3634](https://togithub.com/bazelbuild/rules_go/pull/3634)
- fix `aux_files` relative paths for gomock source mocks (fix
[#&#8203;3752](https://togithub.com/bazelbuild/rules_go/issues/3752)) by
[@&#8203;ikavalio](https://togithub.com/ikavalio) in
[https://github.com/bazelbuild/rules_go/pull/3753](https://togithub.com/bazelbuild/rules_go/pull/3753)
- Update to modern protoc plugins by
[@&#8203;mering](https://togithub.com/mering) in
[https://github.com/bazelbuild/rules_go/pull/3761](https://togithub.com/bazelbuild/rules_go/pull/3761)
- Add integration tests for protoc-gen-go-grpc by
[@&#8203;ryanpbrewster](https://togithub.com/ryanpbrewster) in
[https://github.com/bazelbuild/rules_go/pull/3787](https://togithub.com/bazelbuild/rules_go/pull/3787)
- Add Bzlmod support for `nogo` by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[https://github.com/bazelbuild/rules_go/pull/3782](https://togithub.com/bazelbuild/rules_go/pull/3782)
- fix(gpd): don't panic on invalid root by
[@&#8203;JamyDev](https://togithub.com/JamyDev) in
[https://github.com/bazelbuild/rules_go/pull/3779](https://togithub.com/bazelbuild/rules_go/pull/3779)
- Pass env to gentestmain so it will correctly filter by
[@&#8203;patrickmscott](https://togithub.com/patrickmscott) in
[https://github.com/bazelbuild/rules_go/pull/3785](https://togithub.com/bazelbuild/rules_go/pull/3785)
- prepare release 0.44.0 by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[https://github.com/bazelbuild/rules_go/pull/3788](https://togithub.com/bazelbuild/rules_go/pull/3788)

#### New Contributors

- [@&#8203;Clement-Jean](https://togithub.com/Clement-Jean) made their
first contribution in
[https://github.com/bazelbuild/rules_go/pull/3773](https://togithub.com/bazelbuild/rules_go/pull/3773)
- [@&#8203;ikavalio](https://togithub.com/ikavalio) made their first
contribution in
[https://github.com/bazelbuild/rules_go/pull/3753](https://togithub.com/bazelbuild/rules_go/pull/3753)
- [@&#8203;ryanpbrewster](https://togithub.com/ryanpbrewster) made their
first contribution in
[https://github.com/bazelbuild/rules_go/pull/3787](https://togithub.com/bazelbuild/rules_go/pull/3787)

**Full Changelog**:
bazel-contrib/rules_go@v0.43.0...v0.44.0

</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.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

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

---

This PR has been generated by [Renovate
Bot](https://togithub.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMDAuMCIsInVwZGF0ZWRJblZlciI6IjM2LjEwMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: Self-hosted Renovate Bot <361546+cgrindel-self-hosted-renovate[bot]@users.noreply.github.enterprise.com>
@sluongng
Copy link
Contributor

sluongng commented Jan 5, 2024

Tried this out today.

Given this setup https://github.com/buildbuddy-io/buildbuddy/blob/fe06bd31053246afb8a499dea6a9b86633727863/proto/jaeger/BUILD

And this patch

diff --git a/proto/jaeger/BUILD b/proto/jaeger/BUILD
index 7c25d6697..f1f2f2f64 100644
--- a/proto/jaeger/BUILD
+++ b/proto/jaeger/BUILD
@@ -18,7 +18,7 @@ proto_library(

 go_proto_library(
     name = "jaeger_go_proto",
-    compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+    compilers = ["@io_bazel_rules_go//proto:go_grpc_v2"],
     importpath = "github.com/buildbuddy-io/buildbuddy/proto/jaeger",
     proto = ":jaeger_proto",
     deps = [

I got

# Configuration: 3e5db740cb435843d39c6a2b05c6682e49f63f4b0d2fd08653a6c78ecb4166f7
# Execution platform: //platforms:linux_x86_64
bazel-out/linux_x86_64-fastbuild/bin/proto/jaeger/jaeger_go_proto_/github.com/buildbuddy-io/buildbuddy/proto/jaeger/query_grpc.pb.go:21:36: undefined: GetTraceRequest
bazel-out/linux_x86_64-fastbuild/bin/proto/jaeger/jaeger_go_proto_/github.com/buildbuddy-io/buildbuddy/proto/jaeger/query_grpc.pb.go:22:40: undefined: ArchiveTraceRequest
bazel-out/linux_x86_64-fastbuild/bin/proto/jaeger/jaeger_go_proto_/github.com/buildbuddy-io/buildbuddy/proto/jaeger/query_grpc.pb.go:22:88: undefined: ArchiveTraceResponse
bazel-out/linux_x86_64-fastbuild/bin/proto/jaeger/jaeger_go_proto_/github.com/buildbuddy-io/buildbuddy/proto/jaeger/query_grpc.pb.go:23:38: undefined: FindTracesRequest
bazel-out/linux_x86_64-fastbuild/bin/proto/jaeger/jaeger_go_proto_/github.com/buildbuddy-io/buildbuddy/proto/jaeger/query_grpc.pb.go:24:39: undefined: GetServicesRequest
bazel-out/linux_x86_64-fastbuild/bin/proto/jaeger/jaeger_go_proto_/github.com/buildbuddy-io/buildbuddy/proto/jaeger/query_grpc.pb.go:24:86: undefined: GetServicesResponse
bazel-out/linux_x86_64-fastbuild/bin/proto/jaeger/jaeger_go_proto_/github.com/buildbuddy-io/buildbuddy/proto/jaeger/query_grpc.pb.go:25:41: undefined: GetOperationsRequest
bazel-out/linux_x86_64-fastbuild/bin/proto/jaeger/jaeger_go_proto_/github.com/buildbuddy-io/buildbuddy/proto/jaeger/query_grpc.pb.go:25:90: undefined: GetOperationsResponse
bazel-out/linux_x86_64-fastbuild/bin/proto/jaeger/jaeger_go_proto_/github.com/buildbuddy-io/buildbuddy/proto/jaeger/query_grpc.pb.go:53:11: undefined: SpansResponseChunk
bazel-out/linux_x86_64-fastbuild/bin/proto/jaeger/jaeger_go_proto_/github.com/buildbuddy-io/buildbuddy/proto/jaeger/query_grpc.pb.go:94:11: undefined: SpansResponseChunk
bazel-out/linux_x86_64-fastbuild/bin/proto/jaeger/jaeger_go_proto_/github.com/buildbuddy-io/buildbuddy/proto/jaeger/query_grpc.pb.go:25:90: too many errors
compilepkg: error running subcommand external/go_sdk_linux/pkg/tool/linux_amd64/compile: exit status 2

Reverted to v1 and everything just works.

@ryanpbrewster
Copy link
Contributor

I think you need two compilers:

[
  "@io_bazel_rules_go//proto:go_proto",
  "@io_bazel_rules_go//proto:go_grpc_v2",
]

That's what the go_grpc_library helper does (I believe it's convenience wrapper around go_proto_library that automatically configures those two compilers.

@sluongng
Copy link
Contributor

sluongng commented Jan 5, 2024

Thanks @ryanpbrewster for the tip! It worked after including :go_proto compiler.

But it seems like most of our go_proto_library targets are under Gazelle control.

So a simple gazelle run would revert all the changes as follow

-load("@io_bazel_rules_go//proto:def.bzl", "go_grpc_library")
+load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")

 # gazelle:default_visibility //enterprise/server/test/integration/remote_execution:__subpackages__
 package(default_visibility = [
@@ -11,8 +11,9 @@ proto_library(
     srcs = ["remote_execution_test.proto"],
 )

-go_grpc_library(
+go_proto_library(
     name = "remoteexecutiontest_go_proto",
+    compilers = ["@io_bazel_rules_go//proto:go_grpc"],
     importpath = "github.com/buildbuddy-io/buildbuddy/enterprise/server/test/integration/remote_execution/proto",
     proto = ":remoteexecutiontest_proto",
 )

So the deprecation was merged a bit too early. Ideally, it should be merged only after bazel-contrib/bazel-gazelle#1711

@mering
Copy link
Contributor Author

mering commented Jan 5, 2024

@sluongng https://github.com/golang/protobuf has been superceded by the new compilers 4 years ago. So I would argue the deprecation warning in this repo was actually rather late than early.

@ryanpbrewster
Copy link
Contributor

For anyone else that finds there way to this PR because they are fighting with gazelle: you can add this directive to a BUILD file and it will affect all subpackages:

# gazelle:go_grpc_compilers	@io_bazel_rules_go//proto:go_proto,@io_bazel_rules_go//proto:go_grpc_v2

This instructs gazelle to install the appropriate compilers

@sluongng
Copy link
Contributor

sluongng commented Jan 8, 2024

@mering I am not opposed to upgrading to the new compiler in rules_go and gazelle. However, we should not mark the compiler in rules_go as deprecated until the new compiler is on feature parity with the old compiler (i.e. Gazelle support).

It reminds me of this Goomics https://goomics.net/50/ that folks often share with me when adopting Google's APIs/tools. And it would cost us little to make it happen (deplaying the rules_go release a bit more until the Gazelle change was merged).

@ryanpbrewster that's a useful workaround. Thanks! I hope bazel-contrib/bazel-gazelle#1711 will make it obsolete. 🤞

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.

Use protoc-gen-go-grpc for gRPC compilers
7 participants