Answer the question
In order to leave comments, you need to log in
How to generate protoc --go-grpc_out code in scope of generated --go_out code?
In old projects I used the old proto-gen-go which supported plugins and allowed to generate serialized data and a client / server in one pb.go file
, now I use protoc-gen-go v1.27.1 which, as I understand it, does not support plugins and requires explicit --go-grpc_out flag to generate client\server
according to command
protoc -I /usr/local/include -I $PWD/api/dummy-proto --go_out=generated --go-grpc_out=generated --go_opt=paths=source_relative proto/v1/foo.proto
generated
|_proto
|_v1
|_dummy
| |_foo_grpc.pb.go //package dummy
|_foo.pb.go //package dummy
go_out=import_path=grpc_v1_proto,M$PWD/proto/v1/foo.proto=grpc_v1_proto"
syntax = "proto3";
package dummy.v1.foo;
option go_package = "proto/v1/dummy";
import "proto/v1/structures.proto";
service FooService {
rpc reverse(ReverseRequest) returns (ReverseResponse);
rpc getBar(GetBarRequest) returns (GetBarResponse);
}
message ReverseRequest {
string text = 1;
}
message ReverseResponse {
string reversed_text = 1;
}
message GetBarRequest {
}
message GetBarResponse {
structures.Bar bar = 1;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question