You need to have the
buf
CLI installed to follow along with this example.
This example shows Buf's managed mode in practice. Managed mode is a configuration option that you can set in your buf.gen.yaml
configuration file. If you set enabled
to true
, it instructs the buf
CLI to use an opinionated set of values for each of protoc
's file options for natively supported languages, such as Go, Java, and C#. These options are written on the fly into your Protobuf sources so that you don't need to include them in your .proto
files directly.
To generate code stubs from the Protobuf sources in acme/weather/v1
:
buf generate
When you run this command, the buf
CLI uses the configuration in buf.gen.yaml
to generate code stubs. As you can see in that config, hosted plugins are used, managed mode is enabled, and several managed mode options are set. See the gen/proto
directory for generated code in these languages: