-
Notifications
You must be signed in to change notification settings - Fork 382
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
gazelle generates and recreates grpc targets that rules_go complains about #1709
Comments
@ryanpbrewster @mering Are you seeing this as well? Would you be willing to look into this as a follow-up to bazel-contrib/rules_go#3761? |
A few quick notes:
|
Looking at the documentation here it seems like you can also add a
directive at the top of a BUILD file to tell gazelle how you want grpc services compiled (it supposedly applies recursively, so if you do this at the top level then it ought to take effect in your entire workspace) EDIT: just checked in a sample bazel repo and
seems to work for me (at least it gets |
I never really used Gazelle directly myself but gave it a shot at #1711. I managed to fix the generator but didn't quite manage to fix the fixer. |
I'm seeing this warning as well but for external repos. I just switched over to using bzlmod and the gazelle extension doesn't have the ability to set gazelle directives for all godeps. I have to manually add Prior to bzlmod, I ran gazelle to generate |
We have removed the warning temporarily in bazel-contrib/rules_go@8beaf2e and will provide a way to apply default overrides in #1716. |
What version of gazelle are you using?
0.35
What version of rules_go are you using?
0.44.2
What version of Bazel are you using?
6.4.0
Does this issue reproduce with the latest releases of all the above?
Yes for rules_go and gazelle, but I'm not able to test on bazel 7.0.0
What operating system and processor architecture are you using?
macOS 14.2.1
What did you do?
Gazelle 0.35 and rules_go (both 0.44.1 and 0.44.2) disagree on how to create grpc protobuf targets. If you use gazelle to generate targets for a proto3 proto file that contains
service
to create a GRPC service, it'll generate ago_proto_library
target that setscompilers = ["@io_bazel_rules_go//proto:go_grpc"],
.However,
rules_go
will warn about that:Which implies that you're supposed to use
go_grpc_library
as the macro (fromload("@io_bazel_rules_go//proto:def.bzl", "go_grpc_library")
).The unfortunate thing here is that if you fix this by hand, gazelle will remove your
go_grpc_library
call and theload
statement and replace it with thego_proto_library
target with the compilers set on it.rules_go
seems to have decided on this new pattern a few weeks ago (with a tweak to the deprecation message a bit after that).What did you expect to see?
Gazelle creating grpc targets without warnings
What did you see instead?
Gazelle creating grpc targets with warnings
The text was updated successfully, but these errors were encountered: