Jean-Philippe Ouellet
2018-11-28 10:15:44 UTC
Hello,
tl;dr - What is the correct way to make well-known types available to
protoc when targeting Go?
In the protobuf documentation [1], well-known types are imported with proto
package path "google/protobuf/[...].proto".
In order for protoc to find such files, it is my understanding that they
must be available within a "google/protobuf" subdir of a provided import
path (protoc -I vendor/[...]).
However, github.com/golang/protobuf provides these files only under a
"ptypes/protobuf" directory, which can not be successfully pointed to by
protoc ("ptypes" != "google", import fails with not found).
They are available under google/protobuf within
github.com/protocolbuffers/protobuf/src and
github.com/googleapis/googleapis, among other places, but these are full of
other extraneous files.
I could also play games with protoc arguments like
`Mgoogle/protobuf/timestamp.proto=github.com/golang/protobuf/ptypes/protobuf/timestamp`
to remap every path from google to ptypes, but this most definitely seems
wrong...
Any hints appreciated.
Thanks,
Jean-Philippe
tl;dr - What is the correct way to make well-known types available to
protoc when targeting Go?
In the protobuf documentation [1], well-known types are imported with proto
package path "google/protobuf/[...].proto".
In order for protoc to find such files, it is my understanding that they
must be available within a "google/protobuf" subdir of a provided import
path (protoc -I vendor/[...]).
However, github.com/golang/protobuf provides these files only under a
"ptypes/protobuf" directory, which can not be successfully pointed to by
protoc ("ptypes" != "google", import fails with not found).
They are available under google/protobuf within
github.com/protocolbuffers/protobuf/src and
github.com/googleapis/googleapis, among other places, but these are full of
other extraneous files.
I could also play games with protoc arguments like
`Mgoogle/protobuf/timestamp.proto=github.com/golang/protobuf/ptypes/protobuf/timestamp`
to remap every path from google to ptypes, but this most definitely seems
wrong...
Any hints appreciated.
Thanks,
Jean-Philippe
--
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+***@googlegroups.com.
To post to this group, send email to ***@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 the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.