-
Notifications
You must be signed in to change notification settings - Fork 415
Description
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 a go_proto_library target that sets compilers = ["@io_bazel_rules_go//proto:go_grpc"],.
However, rules_go will warn about that:
WARNING: /path/to/proto/BUILD.bazel:12:17: in go_proto_library rule //proto/proto:mytarget_go_proto: target '//proto/mytarget_go_proto' depends on deprecated target '@io_bazel_rules_go//proto:go_grpc': Migrate to //proto:go_grpc_v2 compiler (which you'll get automatically if you use the go_grpc_library() rule).
Which implies that you're supposed to use go_grpc_library as the macro (from load("@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 the load statement and replace it with the go_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