golang / protobuf

Go support for Google's protocol buffers
BSD 3-Clause "New" or "Revised" License
9.74k stars 1.58k forks source link

Would it be possible to remove the serialized copy of the proto source by using golang embed? #1491

Closed leighst-anchorage closed 2 years ago

leighst-anchorage commented 2 years ago

Generated files contain a serialized copy of the source file in a field ending with rawDesc. This guarantees merge conflicts if two people are working on the same file at the same time. Would it in theory be possible to replace this with a go embed?

Or is the rawDesc actually needed to produce a functional generated file? I think I read somewhere that the generated code on its own is not sufficient for protobuf to be actually used in a specific language.

Wondering if there's any way at all to avoid this.

dsnet commented 2 years ago

The rawDesc is actually necessary for the functionality of protobuf runtime since protobuf reflection has been made a first class feature of the protobuf module.

leighst-anchorage commented 2 years ago

Thanks

puellanivis commented 2 years ago

Closing this issue since it’s non-actionable.

leighst-anchorage commented 1 year ago

Is there any reason we can't use embed? In a big monorepo with many services where we dont use bazel, its very handy to merge generated pb go files. But they always conflict right now.

Would you accept a PR to switch to embed? (Maybe use build tags to avoid the compiler version compatibility issue?)