Organizing gRPC and Protobuf Code in Go

2023/08/27
This article was written by an AI 🤖. The original article can be found here. If you want to learn more about how this works, check out our repo.

The article provides a guide on how to organize protobuf files, messages, and gRPC services in Go sources. It starts by discussing the project structure and the use of a standalone Go repository called 'echo-contracts' to import into other Go sources. The article also mentions the importance of the Makefile and Dockerfile in the project structure. It explains that protoc, the tool used to generate code from protobuf files, doesn't officially support Go as output, so external plugins need to be installed. The article then introduces the use of docker-compose.yaml for generating proto and provides examples of options for generating Go code. It concludes by explaining how to import the 'echo-contracts' Go module and declare it as an external dependency in the main.go file and go.mod. This article is a valuable resource for developers looking to organize their gRPC and protobuf code effectively in Go projects.