admin管理员组文章数量:1122846
When generating grpc code for protocol buffers. received this error
My .proto file - was following the basic tutorial from the GRPC Docs - GRPC Docs
message Point {
int32 latitude = 1 ;
int32 longitude = 2 ;
}
message Rectangle {
Point lo = 1 ;
Point hi = 2 ;
}
message Feature {
string name = 1 ;
Point location = 2 ;
}
message RouteNote {
Point location = 1 ;
string message = 2 ;
}
message RouteSummary {
int32 point_count = 1 ;
int32 feature_count = 2 ;
int32 distance = 3 ;
int32 elapsed_time = 4 ;
}
service RouteGuide{
rpc GetFeature(Point) returns (Feature) {}
rpc ListFeatures(Rectangle) returns (stream Feature) {}
rpc RecordRoute(stream Point) returns (RouteSummary) {}
rpc RouteChat(stream RouteNote) returns (stream RouteNote) {}
}
Received the error
route_guide.proto:5:1: Expected "required", "optional", or "repeated".
When generating grpc code for protocol buffers. received this error
My .proto file - was following the basic tutorial from the GRPC Docs - GRPC Docs
message Point {
int32 latitude = 1 ;
int32 longitude = 2 ;
}
message Rectangle {
Point lo = 1 ;
Point hi = 2 ;
}
message Feature {
string name = 1 ;
Point location = 2 ;
}
message RouteNote {
Point location = 1 ;
string message = 2 ;
}
message RouteSummary {
int32 point_count = 1 ;
int32 feature_count = 2 ;
int32 distance = 3 ;
int32 elapsed_time = 4 ;
}
service RouteGuide{
rpc GetFeature(Point) returns (Feature) {}
rpc ListFeatures(Rectangle) returns (stream Feature) {}
rpc RecordRoute(stream Point) returns (RouteSummary) {}
rpc RouteChat(stream RouteNote) returns (stream RouteNote) {}
}
Received the error
route_guide.proto:5:1: Expected "required", "optional", or "repeated".
Share
Improve this question
asked yesterday
Tushar GuptaTushar Gupta
611 silver badge4 bronze badges
New contributor
Tushar Gupta is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1 Answer
Reset to default 3I found an answer after some time. All I needed to do was to specify the .proto syntax I was using with the file
syntax = "proto3";
package routeguide;
option go_package = "/proto";
Read more here
本文标签:
版权声明:本文标题:go - Expected "required", "optional", or "repeated". GRPC Golang - Stack O 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736282096a1926532.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论