--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.
To post to this group, send email to prot...@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.
Sorry for the delayed response! I've written about 3-4 draft replies over this week that I've discarded because they don't meet your requirements. I'll think about it more over the long weekend and get back to you.Cheers,-Ross
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+unsubscribe@googlegroups.com.
Usually not too tricky. The problem is that protos and most other programming languages prohibit circular imports at the file level, and Go does it at the package level. The fact that protoc and the other languages are okay with a topology ensures there is a valid Go repackaging that will work.
Zellyn
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.
To post to this group, send email to prot...@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Protocol Buffers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/protobuf/W2zN-xKsdgk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to protobuf+u...@googlegroups.com.
Yeah I can do anything with a wrapper. But to the extent that our concerns and structure are normal, it would be a shame to need a wrapper.
Zellyn and I talked a little bit at Gophercon about this. I think some kind of wrapper is in order for his use case: it may actually be a filter between protoc and protoc-gen-go.
On Tue, Jul 12, 2016, 8:49 AM Damien Neil <dn...@google.com> wrote:If I'm following this correctly, your core problem is that protoc doesn't understand vendored paths as used by the go tool. For example:- You have a proto file located in src/square/up/protos/square.proto.- square.proto imports "github.com/golang/protobuf/ptypes/timestamp/timestamp.proto".- timestamp.proto is actually located in "src/square/up/vendor/github.com/.../timestamp.proto".You can't run "protoc --go_out=. square/up/protos/square.proto", because protoc won't be able to locate the vendored copy of timestamp.proto. If it did, everything would work correctly without setting an import_prefix.It would be nice for Go users if protoc did understand vendored paths. Failing that, however, I think you can get what you want with a very small wrapper around protoc. The wrapper can copy a proto and all its dependencies into a temp directory (pulling dependencies from vendored paths as necessary), run protoc there, and copy the result back. e.g., in the case of the above example:$ mkdir -p /tmp/x/square/up/protos$ cp src/square/up/protos/square.proto /tmp/x/square/up/protos$ mkdir -p /tmp/x/github.com/golang/protobuf/ptypes/timestamp$ cp square/up/vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.proto github.com/golang/protobuf/ptypes/timestamp$ cd /tmp/x && protoc -go_out=. square/up/protos/square.proto$ cp /tmp/x/square/up/protos/square.pb.go square/up/protosThe generated .go files will reference non-vendored paths, which the Go compiler will resolve to the correct vendored directory.Does that seem like it would work for you?
Zellyn and I talked a little bit at Gophercon about this. I think some kind of wrapper is in order for his use case: it may actually be a filter between protoc and protoc-gen-go.
If I'm following this correctly, your core problem is that protoc doesn't understand vendored paths as used by the go tool. For example:- You have a proto file located in src/square/up/protos/square.proto.- square.proto imports "github.com/golang/protobuf/ptypes/timestamp/timestamp.proto".- timestamp.proto is actually located in "src/square/up/vendor/github.com/.../timestamp.proto".You can't run "protoc --go_out=. square/up/protos/square.proto", because protoc won't be able to locate the vendored copy of timestamp.proto. If it did, everything would work correctly without setting an import_prefix.It would be nice for Go users if protoc did understand vendored paths. Failing that, however, I think you can get what you want with a very small wrapper around protoc. The wrapper can copy a proto and all its dependencies into a temp directory (pulling dependencies from vendored paths as necessary), run protoc there, and copy the result back. e.g., in the case of the above example:$ mkdir -p /tmp/x/square/up/protos$ cp src/square/up/protos/square.proto /tmp/x/square/up/protos$ mkdir -p /tmp/x/github.com/golang/protobuf/ptypes/timestamp$ cp square/up/vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.proto github.com/golang/protobuf/ptypes/timestamp$ cd /tmp/x && protoc -go_out=. square/up/protos/square.proto$ cp /tmp/x/square/up/protos/square.pb.go square/up/protosThe generated .go files will reference non-vendored paths, which the Go compiler will resolve to the correct vendored directory.Does that seem like it would work for you?
On Sun, Jul 10, 2016 at 12:32 PM, Zellyn Hunter <zel...@gmail.com> wrote: