-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Description
I generally tend to use buf rather than directly calling protoc, so I had to do a bit of work to figure out how to make this work with that.
Here's my solution:
buf.yaml
version: v2
modules:
- path: protobuf.gen.yaml
version: v2
clean: true
managed:
enabled: true
plugins:
- local: ["go", "tool", "github.com/knqyf263/go-plugin/cmd/protoc-gen-go-plugin"]
out: pkg
opt:
- paths=source_relative
strategy: directory
include_imports: true
include_wkt: trueAnd added the following to my go.mod (making use of the new tool directive):
tool (
github.com/bufbuild/buf/cmd/buf
github.com/bufbuild/buf/cmd/protoc-gen-buf-breaking
github.com/bufbuild/buf/cmd/protoc-gen-buf-lint
github.com/knqyf263/go-plugin/cmd/protoc-gen-go-plugin
)I can now run:
go tool buf generateAnd have it generate the code from my proto folder into my pkg folder.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels