Skip to content

2.4. gRPC

Rafał Lorenz edited this page Jun 29, 2019 · 2 revisions

Generating client and server code

Next we need to generate the gRPC client and server interfaces from our .proto service definition. We do this using the protocol buffer compiler protoc with a special gRPC Go plugin. For more info read

From the root directory run:

$ cd cmd/user/infrastructure/proto && protoc --go_out=plugins=grpc:. user.proto

Running this command generates the following file in the cmd/user/infrastructure/proto directory:

  • user.pb.go

This contains:

All the protocol buffer code to populate, serialize, and retrieve our request and response message types An interface type (or stub) for clients to call with the methods defined in the services. An interface type for servers to implement, also with the methods defined in the services.

Clone this wiki locally