protobuf
protobuf copied to clipboard
Generated files conflict with each other on different computers
When generating go files, gogoproto seems to generate it differently depending on the version of protoc installed on a particular machine. Which causes a lot of problems when editing proto files as even a small edit ends up in a lot of
-func init() { proto.RegisterFile("foo.proto", fileDescriptor_foo_b018e233b5cfb1ea) }
+func init() { proto.RegisterFile("foo.proto", fileDescriptor_foo_2c2bda422249515b) }
everywhere. It's basically impossible to lock down anything like that. Is it possible to turn it off somehow?
i've seen this before.
check that your protoc
version matches on each system
Checking that all developers use the same version of protoc is not not very realistic honestly. Also not quite sure what the benefit of it is. The hash it generates being the only difference.
Could you let us know if you get this problem with golang/protobuf?
@donaldgraham no. This is how golang/protobuf generates that descriptor variable: https://github.com/golang/protobuf/blob/8d0c54c1246661d9a51ca0ba455d22116d485eaa/protoc-gen-go/generator/generator.go#L284
Basically just "fileDescriptor_" + hashOf(filename)
Whereas gogo involves some complicated magic scheme with descriptor fingerprinting: https://github.com/gogo/protobuf/blob/e5d5b02ea0b3c4fd2a996e909ffa0f3421d6c91b/protoc-gen-gogo/generator/generator.go#L319
Thanks. That's useful information.
i met the same problem.....Has anyone solved this problem yet😭😭