Command line tool and workflow for organising code generation of Google's protocol buffers across multiple projects.
Using Google's protocol buffers bring great potential for substantial performance gains and type safety over the wire. But it also comes with the constraint that you need to share proto files among all your service providers and consumers.
Protogen works under the assumption, and with the approach that proto files should be centralised in one repository, divided into packages, version tagged and made available through Git. What the protogen tool provides is a workflow for organising and versioning your protobuf contracts by abstracting protoc and git, acting like a package manager for protoc generated code.
Our motive is to help you focus on collaborating with your colleuages, design powerful APIs and build great projects.
The protogen project consists of three things, the command line tool, the workflow and the .protogen file written with the protogen configuration language. These are all the things you need to manage your proto files.
The command line tool is used to both manage your central protobuf repository and to automate code generation in service and consumer projects.
The easiest way of obtaining the protogen command line tool for any platform is by installing it through Go package installer. Run the command and immediately have access to the tool.
$ go get -u github.com/zeeraw/protogen
The protogen workflow is how you should manage your central protobuf repository. This includes how to structure your packages and how to tag your releases. Visit our example repository where we showcase how to structure our proto files. You can also read more about the protogen workflow on the wiki.
The .protogen file is a definition of what protobuf code should be generated inside a given project. To write the file you use the protogen configuration language.
source github.com/zeeraw/protogen-protos
output ./vendor/protos
language go {
plugin grpc
}
generate services/games v1.0.1
generate services/foobar v3.0.0
We provide protogen file syntax highlighting and snippets for a few different editors.
- Visual Studio Code (official)