Description
🐛 Bug Report
Some of the .pb.go
files that get generated contain calls to methods in other generated files, but said methods don't actually exist.
To Reproduce
I'm afraid this is going to be a terrible bug report since I'm unable to share any of the files that I'm working with but we'll see. I'm not sure where this issue stems from and if the problem lies in grpc-gateway or elsewhere but here's an attempt at describing what happens.
I have a proto at path ~/dev/services/my-org/my-service/v1/my_service.proto
. The proto package is package my-org.my-service.v1;
and I've declared option go_package = "my-org.com/rest-proxy/my-service/v1"
The proto includes an import of another proto ("other.proto") which is located in the same folder as the service proto.
From inside ~/dev/services/my-org
I execute the following commands for both protos:
protoc -I$PROTO_INCLUDE --go_out=paths=source_relative:my-org/my-service/gen/grpc-gateway/src/gen $PROTO
protoc -I$PROTO_INCLUDE --go-grpc_out=paths=source_relative:my-org/my-service/gen/grpc-gateway/src/gen $PROTO
protoc -I$PROTO_INCLUDE --grpc-gateway_out=paths=source_relative,logtostderr=true:my-org/my-service/gen/grpc-gateway/src/gen $PROTO
In the generated my-service.pb.go
there is now a function called file_v1_my_service_proto_init()
, which contains what I assume is meant to be a call to the corresponding init function of other.pb.go
. The problem is that this function has the wrong name.
If I look in the generated file for other.proto
, its init function is called file_v1_other_proto_init
. However, the function we're trying to call from my_proto.pb.go
is called file_services_my_org_v1_other_proto_init
. It thus seems to assume that the init function name is derived from the file path rather than anything else.
Expected behavior
I would expect consistent names to be used across the board.
Actual Behavior
Somewhere there is a disconnect between what things are actually called and what they are "expected" to be called.
Your Environment
grpc-gateway v2.0.0-beta.4
protoc v 3.12.2
As I said, no idea where the root of this issue is but if possible I would like some input on what's going on here.
Thanks!