bufbuild / buf

The best way of working with Protocol Buffers.
https://buf.build
Apache License 2.0
8.89k stars 265 forks source link

`buf generate <input> --exclude-path="..."` doesn't seem to work for buf Schema Registry package #2403

Closed maoueh closed 1 year ago

maoueh commented 1 year ago

Using buf.gen.yaml:

version: v1
plugins:
  - plugin: buf.build/protocolbuffers/go:v1.31.0
    out: gen

If I do:

$ rm -rf gen
$ buf generate buf.build/streamingfast/substreams --exclude-path="sf/substreams/rpc"
...

$ file gen/github.com/streamingfast/substreams/pb/sf/substreams/rpc
gen/github.com/streamingfast/substreams/pb/sf/substreams/rpc: directory

Protos under sf/substreams/rpc (https://buf.build/streamingfast/substreams/tree/main:sf/substreams/rpc/v2) path are still generated.

If I use a raw Protobuf binary (the one used below is not exactly the same as the buf uploaded version, but both contains sf/substreams/rpc as a "path"):

$ rm -rf gen
$ buf generate "https://github.com/streamingfast/substreams/raw/develop/pb/system/system.pb#format=bin" --exclude-path="sf/substreams/rpc"

$ file gen/github.com/streamingfast/substreams/pb/sf/substreams/rpc
gen/github.com/streamingfast/substreams/pb/sf/substreams/rpc: cannot open `gen/github.com/streamingfast/substreams/pb/sf/substreams/rpc' (No such file or directory)

I would have though that --exclude-path would work even with bug Schema registry packages.

bufdev commented 1 year ago

This should be fixed by #2404 and will go out in the next release. Apologies for the troubles.

maoueh commented 1 year ago

No problem and thank you guys!