protoc-gen-validate
protoc-gen-validate copied to clipboard
Include the version of protoc-gen-validate in the generated output
Is your feature request related to a problem? Please describe.
As a user, I would like to know which version is used to generate a particular piece of code that is included in my dependencies.
At the moment I only see:
// Code generated by protoc-gen-validate. DO NOT EDIT.
without any indication of the version used.
Describe the solution you'd like
In the generated file, I would like to see the version of protoc-gen-validate that was used to generate a particular piece of code.
This could be useful in case a bug is fixed in a given generator version and regenerating the code could be a viable solution to a problem.
I'd like to take this. By the way, it seems we don't have version information in the project. Is it necessary to add a version.go file to define protoc-gen-validate version?
Hey, go for it! You may be able to get the module version at runtime using https://pkg.go.dev/runtime/debug#ReadBuildInfo
Is there any way to have a string with semantic versioning directly available in the code instead of relying on runtime introspection? I'm concerned about whether or not the string I will get will be "readable".
Is there any way to have a string with semantic versioning directly available in the code instead of relying on runtime introspection? I'm concerned about whether or not the string I will get will be "readable".
The reason I'm recommending the use of the BuildInfo is that a version file is often a "lie." For instance, 0.6.1 was released in April, and there have been some commits since then. During that time, if we had a version file, 0.6.1 would be the version provided for any build of any commit since the actual release. Go modules on the other hand respect semver, while also having a consistent scheme for non-release modules.
@rodaine Would it be something like this: https://github.com/envoyproxy/protoc-gen-validate/pull/516