Closed
Description
🐛 Bug Report
The option module fails for protoc-gen-grpc-gateway v2.
Actually, the issue is that the module prefix is removed a first time by protoc-gen-grpc-gateway, then protogen attempts to remove the prefix a second time. It then fails with an error "generated file does not match prefix".
To Reproduce
-
Create a service file
service.proto
:syntax = "proto3"; package your.service.v1; option go_package = "github.com/yourorg/yourproject/your/service/v1"; message StringMessage { string value = 1; } service YourService { rpc Echo(StringMessage) returns (StringMessage) {} }
-
Generate protobuf definitions and go-grpc with option
module=
:protoc -I . \ --go_out . \ --go_opt module=github.com/yourorg/yourproject \ --go-grpc_out . \ --go-grpc_opt module=github.com/yourorg/yourproject \ service.proto
-
Then, use protoc-gen-grpc-gateway with the same
module=
option:protoc -I . \ --grpc-gateway_out . \ --grpc-gateway_opt module=github.com/yourorg/yourproject \ --grpc-gateway_opt logtostderr=true \ --grpc-gateway_opt generate_unbound_methods=true \ service.proto
It fails with:
--grpc-gateway_out: your/service/v1/service.pb.gw.go: generated file does not match prefix "github.com/yourorg/yourproject"
Expected behavior
I'd expect the last command to generate your/service/v1/service_grpc.pb.go
.
Actual Behavior
See above
Your Environment
Fedora 32
➜ protoc --version
libprotoc 3.11.2
➜ protoc-gen-go-grpc -version
protoc-gen-go-grpc 1.0
Metadata
Metadata
Assignees
Labels
No labels