protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

Where do I find source .proto files?

Open AWinterman opened this issue 2 years ago • 6 comments

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!

AWinterman avatar Jan 28 '22 20:01 AWinterman

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

puellanivis avatar Jan 29 '22 12:01 puellanivis

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

Yep!

AWinterman avatar Jan 29 '22 16:01 AWinterman

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

puellanivis avatar Jan 31 '22 18:01 puellanivis

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

AWinterman avatar Feb 01 '22 01:02 AWinterman

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.

cybrcodr avatar Feb 01 '22 02:02 cybrcodr

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?

AWinterman avatar Feb 01 '22 03:02 AWinterman