正在生成服务但不是客户端协议

Service being generated but not client protoc

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

我的 make 文件中有以下内容

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 但没有生成界面或客户端。

这是我在生成 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