I have a .proto file that has a fair number of gogoprotobuf-specific options inside it. The top of the file looks like this:
// Go-specific options
option go_package = "protobuf";
import "code.google.com/p/gogoprotobuf/gogoproto/gogo.proto";
option (gogoproto.sizer_all) = true;
option (gogoproto.marshaler_all) = true;
option (gogoproto.unmarshaler_all) = true;
option (gogoproto.populate_all) = true; // needed by testgen
option (gogoproto.equal_all) = true; // needed by testgen
option (gogoproto.testgen_all) = true;
I'd like to share this .proto file across a few different projects in different languages including Python, Java, C#, and Obj-C. But obviously I'd like for people to not need to import gogo.proto if they're not using Go.
My first thought was to move the Go-specific stuff into a separate foo-go.proto file that imports foo.proto. If the import is not marked "public" then foo-go.pb.go is mostly empty. If I do mark it "public" then foo-go.pb.go has the definitions, but it tries to do 'import foo "foo.pb"' which is also not what I want.
Ideally I'd like for the foo.proto file to be treated as thought it were embedded inside the foo-go.proto file when the code is ultimately generated. Is there a better way to do that?
Thanks,
Joe
Hi,
I have a .proto file that has a fair number of gogoprotobuf-specific options inside it. The top of the file looks like this:
// Go-specific options
option go_package = "protobuf";
import "code.google.com/p/gogoprotobuf/gogoproto/gogo.proto";
option (gogoproto.sizer_all) = true;
option (gogoproto.marshaler_all) = true;
option (gogoproto.unmarshaler_all) = true;
option (gogoproto.populate_all) = true; // needed by testgen
option (gogoproto.equal_all) = true; // needed by testgen
option (gogoproto.testgen_all) = true;
I'd like to share this .proto file across a few different projects in different languages including Python, Java, C#, and Obj-C. But obviously I'd like for people to not need to import gogo.proto if they're not using Go.
My first thought was to move the Go-specific stuff into a separate foo-go.proto file that imports foo.proto. If the import is not marked "public" then foo-go.pb.go is mostly empty. If I do mark it "public" then foo-go.pb.go has the definitions, but it tries to do 'import foo "foo.pb"' which is also not what I want.
Ideally I'd like for the foo.proto file to be treated as thought it were embedded inside the foo-go.proto file when the code is ultimately generated. Is there a better way to do that?
Thanks,
Joe
--
You received this message because you are subscribed to the Google Groups "gogoprotobuf" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gogoprotobuf...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.