Problem:
I have been coding along to a Golang microservices course on Udemy the last week or so and have encountered a problem.
Basically the instructor has introduced us to Go-Micro and RPC by writing a .proto file. Now I have a bit of experience with GRPC, but none with Go-Micro. The problem is that the instructor doesn't show the actual protoc
command and eventual flags, but just brushes over it. I assumed it would be a trivial command, but after running protoc greeter.proto go_out=.
I am missing the client snippets..
Expected:
That the pb.go file would look the same as the instructor's, with client side and server snippets in the pb.go file.
Actual:
Missing client snippets.
Command run:
protoc greeter.proto go_out=.
Code:
.proto file:
syntax = "proto3";
service Greeter {
rpc Hello(HelloRequest) returns (HelloResponse) {}
}
message HelloRequest {
string name = 1;
}
message HelloResponse {
string greeting = 2;
}
I use this command:
from the directory where the proto-files are. It generates as well service as client code. I found this command in one of the many examples from the go-micro github repository and the go-micro web-site.
This is, however, for use with grpc, but the idea is alright.