buf: `buf breaking` with `.txtpb` files
I have protoc outputting a file descriptor set, with a .txtpb extension. When I use the protoc-gen-buf-breaking plugin, the breaking change detector is able to compare against the file descriptor set as expected. However, when I try to do the same via the CLI:
$ buf breaking --limit-to-input-files --against .../foo.txtpb --path bar.proto
I get:
Failure: could not unmarshal image: proto: syntax error (line 2:1): invalid field name: �
Is this expected?
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 17 (9 by maintainers)
I’m not sure, but perhaps you have some other installation issue. If you’re able to provide reproduction steps for us, we’re happy to take a look, but since we’re not able to reproduce this issue, I’m not sure there’s more we can do.
Closing for now, but let us know if you run into other difficulties.
I’ve attempted to create exact end-to-end reproduction steps, but am unable to reproduce the success of this command. If I run:
The result is:
Which is as expected.
Actually I was mistaken -
protoc-gen-buf-breakingIS supposed to useimage.txtpbfor the against input, but uses the result fromprotocfor the main input. Whyimage.txtpbis working in your above command I am not sure - you’d need to give us a specific, reproducible example for how you originally createdimage.txtpbprior to this invocation ofprotoc. If you are saying that this same invocation ofprotocis both creatingimage.txtpbAND running breaking change detection, then this is invalid - the against input is meant to check against previous imput, and what is likely happening here is thatimage.txtpbis empty when you are runningprotoc-gen-buf-breaking. However, without a complete reproducible end-to-end example of the exact commands you are running, includingimage.txtpbcreation, I can’t be sure.With
buf, it’s easy - justbuf build -oto a*.txtpbfile. Withprotoc, it’s very complicated, and not worth pursuing for your case - for completeness, you need to do something likeprotoc -o /dev/stdout path/to/your/file.proto | protoc -I /path/to/google-wkt --decode=google.protobuf.FileDescriptorSet /path/to/google-wkt/google/protobuf/descriptor.proto, but it’s complicated to explain what all of that is.You don’t need to use
protocat all withbuf.buf build -ois all you need, you don’t need to do anyprotoccompilation.