This task takes just a second. Install the gRPC package by running this command:
| $ go get google.golang.org/grpc@v1.32.0 |
| $ go get google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.0.0 |
Then open up your Makefile and update your compile target to match the following to enable the gRPC plugin and compile our gRPC service:
| compile: |
| protoc api/v1/*.proto \ |
| --go_out=. \ |
| --go-grpc_out=. \ |
| --go_opt=paths=source_relative \ |
| --go-grpc_opt=paths=source_relative \ |
| --proto_path=. |
Run $ make compile, and then open up the log_grpc.pb.go file in the api/v1 directory and check out the generated code. You’ll see a working gRPC log client, and the compiler left the log service API for us to implement.