Defining gRPC service

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 simplicity, we’ve provided a bash script that runs protoc for you with the appropriate plugin, input, and output (if you want to run this by yourself, make sure you’ve installed protoc and followed the gRPC-Go installation instructions first): [Read More]

Building a gRPC Client in Go

In this section, we’ll look at creating a Go client for our RouteGuide service. You can see our complete example client code in grpc-go/examples/route_guide/client/client.go. Creating a stub To call service methods, we first need to create a gRPC channel to communicate with the server. We create this by passing the server address and port number to grpc.Dial() as follows: conn, err := grpc.Dial(*serverAddr) if err != nil { ... } defer conn. [Read More]