golang / protobuf

Go support for Google's protocol buffers
BSD 3-Clause "New" or "Revised" License
9.78k stars 1.58k forks source link

Where do I find source .proto files? #1411

Open AWinterman opened 2 years ago

AWinterman commented 2 years ago

I'd like to use the library methods here, and also use the same .proto files that were used to generate these files. While I know that I can simply provide my own, I'd like the assurance of pulling down the same versions of the proto files as these are generated from.

How can I do that? At the readme should contain a link to those files.

Thanks!

puellanivis commented 2 years ago

Do you mean the proto files defining the well-known types?

AWinterman commented 2 years ago

Do you mean the proto files defining the well-known types?

Yep!

puellanivis commented 2 years ago

I think they’re at least available from the mainline protobuf package: https://github.com/protocolbuffers/protobuf

For example, I found here the: any.proto

AWinterman commented 2 years ago

that is well and good, but what happens if that project ever changes? which version of the project is this repository defined from?

cybrcodr commented 2 years ago

For versions >= 1.20, i.e. https://github.com/protocolbuffers/protobuf-go/, the generated Go code for WKT uses the proto files from a downloaded version of the protobuf source repository that @puellanivis pointed out. The version used is specified here -- https://github.com/protocolbuffers/protobuf-go/blob/master/integration_test.go#L38.

AWinterman commented 2 years ago

Perhaps a link to that line in the documentation for the package would be helpful? Or better I'd like to refer to those protos in my project-- is there a way to package them so they are pulled in by go get?