July 2017
Beginner to intermediate
358 pages
10h 54m
English
The protoc application is used for generating our Go code from the proto file definition. In fact, the beautiful thing about protoc is that it can generate code in about 10 different languages. Micro also has the ability to use a protoc plugin to generate your clients and server code automatically. This is a nice feature and can indeed save a few keystrokes.
Let's take a look at how we can generate the Go code that defines our message protocol using protoc. Have a look at the gomicro/proto/kittens.proto file:
1 syntax = "proto3"; 2 3 package bmigo.micro; 4 5 message RequestEnvelope { 6 string service_method = 1; 7 fixed64 seq = 2; 8 } 9 10 message ResponseEnvelope { 11 string service_method = 1; 12 fixed64 seq ...Read now
Unlock full access