我正在尝试从官方文档中学习GRPC,下面是我遵循的grpc-go教程
使用以下命令生成proto
protoc --go_out=$PWD helloworld/helloworld.proto上面的命令将生成没有任何问题的文件helloworld.pb.go,但问题是生成的文件中缺少了客户端存根的代码。
syntax = "proto3";
package helloworld;
// The greeting service definition.
service Greeter {
// Sends a greeting
rpc SayHello (HelloRequest) returns (HelloReply) {}
}
// The request message containing the user's name.
message HelloRequest {
string name = 1;
}
// The response message containing the greetings
message HelloReply {
string message = 1;
}我从客户端连接得到的实际错误是
未定义: helloworld.NewGreeterClient
这发生在greeter_client/main.go文件中的行greeter_client/main.go中。
因为在生成的文件中没有生成客户端存根的原因。
发布于 2020-02-03 13:00:15
问题解决了我对命令有一些问题
这是实际的命令
protoc --go_out=plugins=grpc:$PWD helloworld.proto发布于 2020-02-03 13:00:25
加入-我服从你的命令。例如:
protoc -I helloworld --go_out=${PWD} helloworld/*.protohttps://stackoverflow.com/questions/60039457
复制相似问题