Experimental Rode protobufs.
This project uses buf
to manage protobuf definitions.
There are two configuration files for buf
:
buf.yaml
: The settings for the linter and breaking change detectionbuf.gen.yaml
: Managesprotoc
plugins as well as protobuf dependencies.
With buf
installed, use the following Make targets to work locally:
make lint
: Run thebuf
linter.make breaking
: Check for any breaking changes against definitions inmain
.make test
: Run all quality checks (lint and breaking change detection).make generate
: Output Go code from the protobuf definitions
Generated code is placed in gen
, with Go code nested under gen/go
.
Exclude an entire file from a particular rule by setting ignore_only
in buf.yaml
. You can also use buf
to generate
the configuration: buf lint --error-format config-ignore-yaml
.
Alternatively, for a violation in one file, use a leading comment:
// buf:lint:ignore FIELD_LOWER_SNAKE_CASE
message foo {}
To fix multiple violations, use a another comment line. A list of rule names is available here.
To add a new protoc
plugin, add it under the plugins
list in buf.gen.yaml
.
Use the name without the protoc-gen
prefix, e.g., grpc-gateway
instead of protoc-gen-grpc-gateway
.
- Find the dependency in the Buf Schema Registry
- Add it under the
dep
list inbuf.yaml
- Run
buf mod update
to update thebuf.lock
file
Note that the commit sha in buf.lock
corresponds to the registry's own Git mirror and not the
source repository.