Skip to content
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

proposal: cmd/go: let programs access it's go module version #27370

Closed
smyrman opened this issue Aug 30, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@smyrman
Copy link

commented Aug 30, 2018

Please answer these questions before submitting your issue. Thanks!

This is a proposal so that when installing binaries via the go modules, the program is able to read and display information about the installed version of the program in a standardized manner if it's installed via go get path@version.

What version of Go are you using (go version)?

go version go1.11 darwin/amd64

What did you do?

Install a binary at a particular version. To work-around #24250, install it via a temporary go module:

mkdir test
cd test
mod init test
go get github.com/go-task/task@v2.0.3 
go get github.com/go-task/task/cmd/task@v2.0.3
task --version

What did you expect to see?

I did not expect to see this, but I would like for it to become possible for an application to access and display version information when installed via go get through some standardized mechanism:

$ task --version
task v.2.0.3
Git commit: 467c4360ca80d671278d287333aa6f11e5d04871

What did you see instead?

Output from --version

master

Implementation

For consistency reasons, the implementation should perhaps be similar to that of the runtime.GOOS and runtime.GOARCH constants. SCM information and other metadata except for the version, e.g. the module name, could optionally be exposed.

https://golang.org/pkg/runtime/#pkg-constants

The discussion on #26420 may be relevant.

@gopherbot gopherbot added this to the Proposal milestone Aug 30, 2018

@gopherbot gopherbot added the Proposal label Aug 30, 2018

@mvdan

This comment has been minimized.

Copy link
Member

commented Aug 30, 2018

This is likely a duplicate of #26404, which has been part of the design for a while.

@smyrman

This comment has been minimized.

Copy link
Author

commented Aug 30, 2018

Thanks -- closing as duplicate of #26404.

@smyrman smyrman closed this Aug 30, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.