I am using protoc to try and generate a client / server for my gRPC service.
I have the following in my make file
stripe:
@protoc --go_out=. pkg/proto/stripe/service.proto
My proto file is
syntax = "proto3";
package grpc;
option go_package = "pkg/proto/stripe/";
service Stripe {
rpc UpdateVerification(UpdateVerificationRequest) returns (UpdateVerificationResponse);
}
message UpdateVerificationRequest {
string id = 1;
}
message UpdateVerificationResponse {
}
When I run make stripe
it generates a service.pb.go
but there is no interface or client generated.
Is this something I am missing in the generation CLI command?
CodePudding user response:
Try adding go-grpc_out
, as example:
protoc --go_out=. --go-grpc_out=. pkg/proto/stripe/service.proto
Will generate also the service_grpc.pb.go
file in the same dir of the proto
As suggested in the quickstart giude, the full command could be:
protoc --go_out=. --go_opt=paths=source_relative \
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
pkg/proto/stripe/service.proto