Prerequisites
You can find the code for this chapter at https://github.com/PacktPublishing/gRPC-Go-for-Professionals/tree/main/chapter3. During this chapter, I will be using protoc to generate Go code out of .proto
files. This means that you need to make sure you have protoc installed. You can download a zip file from the Releases page of the Protobuf GitHub repository (https://github.com/protocolbuffers/protobuf/releases); uncompress it and follow the readme.txt
instructions (note: we do intend to use Well-Known Types in the future so make sure you also install the includes). On top of protoc, you are going to need two protoc plugins: protoc-gen-go
and protoc-gen-go-grpc
. The former generates Protobuf code, and the latter generates gRPC code. To add them, you can simply run the following commands:
$ go install google.golang.org/protobuf/cmd/protoc-gen-go @latest $ go install google.golang.org/grpc/cmd/protoc-gen-go- grpc@latest
And finally, make sure...