Skip to content

proposal: provide means of getting information about current module #28467

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
DeedleFake opened this issue Oct 29, 2018 · 2 comments
Closed

proposal: provide means of getting information about current module #28467

DeedleFake opened this issue Oct 29, 2018 · 2 comments

Comments

@DeedleFake
Copy link

DeedleFake commented Oct 29, 2018

Now that versioning exists in Go, it would be very useful if that version information was available from code inside a given module. Other information may also be useful, but the version number is of particular interest.

For example, being able to do something like the following would be very useful:

version := flag.Bool("version", false, "Show version information.")
flag.Parse()

if *version {
  fmt.Printf("Example %v", runtime.Module().Version)
}

runtime's probably not the right place for it, but it was just the first thing that came to mind.

If this exists already or has been talked about before and I've just missed it, I apologize. I searched around on here, on Reddit, on Google, and just through the standard library documentation, too. I didn't see anything obvious.

@gopherbot gopherbot added this to the Proposal milestone Oct 29, 2018
@DeedleFake DeedleFake changed the title proposal: provide a means of getting information about current module proposal: provide means of getting information about current module Oct 29, 2018
@mvdan
Copy link
Member

mvdan commented Oct 29, 2018

Duplicate of #26404.

@mvdan mvdan closed this as completed Oct 29, 2018
@DeedleFake
Copy link
Author

There it is. I figured it must exist somewhere; it seemed too obvious. Thanks.

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

No branches or pull requests

3 participants