Open johanbrandhorst opened 4 years ago
The library with the error looks like this:
go_library(
name = "go_default_library",
srcs = ["reflection_grpc.pb.go"],
embed = [":grpc_reflection_v1alpha_go_proto"],
importpath = "google.golang.org/grpc/reflection/grpc_reflection_v1alpha",
visibility = ["//visibility:public"],
deps = [
"//codes:go_default_library",
"//status:go_default_library",
"@org_golang_google_grpc//:go_default_library",
],
)
This builds a pre-generated file, reflection_grpc.pb.go
, together with build-time generated files. I think reflection_grpc.pb.go
is generated with google.golang.org/grpc/cmd/protoc-gen-go-grpc
, so it includes services but not messages. go_proto_library
uses github.com/golang/protobuf/cmd/protoc-gen-go
, so it includes both services and messages. So the services get declared twice.
Some special incantation to Gazelle may be needed here. If the intent is to use protoc-gen-go-grpc
, perhaps Gazelle should declare a go_proto_compiler
for that and use it automatically. If the intent is to use the pre-generated sources, then there should be an easier way to set build_file_proto_mode = "disable_global"
on repos that need it.
Same problem, I build with go build and it's ok, but with bazel... redeclared
reflection_grpc.pb.go
file in google.golang.org/grpc/reflection/grpc_reflection_v1alpha
caused the problem. We could revert back to google.golang.org/grpc@v1.29.1
or inject a custom BUILD.bazel
file removing reflection_grpc.pb.go
from srcs
as a workaround.@adieu using 1.29.1
allows to temporarily serve as a work-around waiting for the issue to be solved.
@adieu For me it's not an option to switch to 1.29.1. How did you inject a custom build file ? I managed to do it only by using vendored version, but it's not a great solution because I have to make sure to copy over the patched build file every time I run go mod vendor
.
What version of rules_go are you using?
v0.23.3
What version of gazelle are you using?
v0.21.1
What version of Bazel are you using?
v3.3.0
Does this issue reproduce with the latest releases of all the above?
Yes
What operating system and processor architecture are you using?
Linux amd64
What did you do?
Upgraded to grpc-go 1.30.0, ran the bazelisk
go_repository
macro and tried rebuilding.What did you expect to see?
A successful build.
What did you see instead?
A build failure:
See https://app.circleci.com/pipelines/github/johanbrandhorst/bazel-mono/185/workflows/8cfdad13-0197-431e-9fab-17514bd4cba1/jobs/1564/steps for the full log.