You were trying to access those .proto from raw source code, what you need is downloading/installing protobuf compiler (protoc), Please see official github installation instruction (https://github.com/protocolbuffers/protobuf/blob/master/src/README.md). If you are on Visual Studio on Windows, you can also just download the Google.Protobuf.Tools nuget pacakge. The package is then bootstrapp as the following structures:
For this example, ".../package" is where the protobuf compiler and its resources are bootstrapped. .../package/protoc .../package/google/protobuf/*.proto <---these are all the well known types in your protoc generation argument, you will then add "-I=.../package" to instruct protoc where to search for .proto if you have a test.proto file that has *import google/protobuf/any.proto in it. and test.proto resides in .../src, *the protoc generation will look something like this *protoc test.proto -I=<absolute path of .../src> -I=<absolute path of .../package> <and the rest is your platform specific flags>* On Wednesday, November 28, 2018 at 2:15:44 AM UTC-8, Jean-Philippe Ouellet wrote: > > 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` > <http://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+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at https://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.