Skip to content

protoc-gen-go: Add -version flag to print version #599

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

stevenroose
Copy link

@stevenroose stevenroose commented May 10, 2018

Fixes #598 and partially #524.

@dsnet
Copy link
Member

dsnet commented May 10, 2018

Unfortunately, v1.1.0 has already been tagged, so we can't retroactively add this functionality without tagging another minor version (for which this is not worth a minor release on its own).

@dsnet
Copy link
Member

dsnet commented May 10, 2018

Also, I'd rather not hard-code a version string as it is easy for that to get out of sync with the repository tag. Instead, I rather wait for proper versioning support to come with golang/go#24301. It's not just the version of protoc-gen-go you want to encode, but also all of its dependencies (namely the standard library), as that also affects the output.

@stevenroose
Copy link
Author

Unfortunately, v1.1.0 has already been tagged, so we can't retroactively add this functionality without tagging another minor version (for which this is not worth a minor release on its own).

Of course. I just added the latest version, so that it could be updated whenever a new release was made.

Also, I'd rather not hard-code a version string as it is easy for that to get out of sync with the repository tag. Instead, I rather wait for proper versioning support to come with golang/go#24301. It's not just the version of protoc-gen-go you want to encode, but also all of its dependencies (namely the standard library), as that also affects the output.

I agree that an automatic way to include the version into the code would be safer. However I didn't know of any. Waiting for vgo might make sense, but could take more time.

@dsnet
Copy link
Member

dsnet commented May 11, 2018

Waiting for vgo might make sense, but could take more time.

It's certainly the correct path forward to fixing this. Russ is aiming to get vgo support into Go1.11, which is 3 months out. I'd rather wait for that.

Is there something that absolutely requires versioning info now? Or is this just a "nice to have"?

@stevenroose
Copy link
Author

stevenroose commented May 12, 2018 via email

@dsnet
Copy link
Member

dsnet commented Jun 6, 2018

Closing this in favor of vgo support, which is moving along.

@dsnet dsnet closed this Jun 6, 2018
@stevenroose
Copy link
Author

vgo doesn't really solve this. This is about external tools being able to determine the version of the executable.

@mvdan
Copy link
Member

mvdan commented Jun 6, 2018

Maybe this should wait until the upcoming go release command. It sounds to me like exposing version information for executables is something it would do.

@stevenroose
Copy link
Author

I'm ok with waiting until a good approach is figured out. But if it's closed, I feel like it'll be forgotten about soon :)

@mvdan
Copy link
Member

mvdan commented Jun 6, 2018

Agreed. I've been struggling with the same problem in some projects of mine, and have temporarily added hard-coded version constants in a couple. I started watching this thread in the hopes that a better idea would come up :)

@dsnet
Copy link
Member

dsnet commented Jun 9, 2018

I do care about having good versioning strings in protoc-gen-go, but I'm not fond of doing extra plumbing work for something that will probably be solved in the coming months. There are many other protobuf issues to address that is probably better to spend the limited time on.

@stevenroose
Copy link
Author

I totally agree. But again, there's no harm in this issue being open and low priority.

@dsnet
Copy link
Member

dsnet commented Jun 9, 2018

Perhaps, I'm misunderstanding something, but there is an open issue for this? #524

@stevenroose
Copy link
Author

That issue is about logging the version used in the generated code.

For now, I would be happy to just see items 1 and 2 start being encoded in the generated infolog.

That's different than having the executable log its version (like almost all GNU executables do, fwiw) so that tooling can check this version before generating new code.

@dsnet
Copy link
Member

dsnet commented Jun 9, 2018

That issue is a superset of the functionality requested here. I still want item 3 in that list (which is why that issue is still open). Once #524 is achievable, it is trivial to expose a command-line flag that exposes this information. I think we're spending time debating the same thing.

@golang golang locked and limited conversation to collaborators Jun 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

protoc-gen-go --version
3 participants