正在生成服务,但未生成客户端协议



我正在使用protoc尝试为我的gRPC服务生成客户端/服务器。

我的制作文件中有以下内容

stripe:
@protoc --go_out=. pkg/proto/stripe/service.proto

我的原始文件是

syntax = "proto3";
package grpc;
option go_package = "pkg/proto/stripe/";
service Stripe {
rpc UpdateVerification(UpdateVerificationRequest) returns (UpdateVerificationResponse);
}
message UpdateVerificationRequest {
string id = 1;
}
message UpdateVerificationResponse {
}

当我运行make stripe时,它会生成service.pb.go,但没有生成接口或客户端。

这是我在generation CLI命令中缺少的内容吗?

尝试添加go-grpc_out,例如:

protoc --go_out=. --go-grpc_out=.   pkg/proto/stripe/service.proto

还会在原型的同一目录中生成service_grpc.pb.go文件

正如quickstart giude中所建议的,完整的命令可以是:

protoc --go_out=. --go_opt=paths=source_relative 
--go-grpc_out=. --go-grpc_opt=paths=source_relative 
pkg/proto/stripe/service.proto

最新更新