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: add go version --short #72867

Closed
pjebs opened this issue Mar 14, 2025 · 3 comments
Closed

proposal: cmd/go: add go version --short #72867

pjebs opened this issue Mar 14, 2025 · 3 comments

Comments

@pjebs
Copy link
Contributor

pjebs commented Mar 14, 2025

Currently,

$ go version
go version go1.13.6 linux/amd64

It would be nice if

$ go version --short
1.13.6

Not every operating system or terminal app has consistent utility applications to extract it like this:

$ v=`go version | { read _ _ v _; echo ${v#go}; }`
$ echo $v
1.13.6

https://stackoverflow.com/questions/59820549/how-to-extract-only-version-from-go-version-command-using-sed-or-other-bash-co

@seankhliao
Copy link
Member

I think this is like #55136, if you need to script something, then you'll already have the necessary processing tools.

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Mar 14, 2025
@Jorropo Jorropo changed the title Feature request: Go version --short proposal: cmd/dist: add go version --short Mar 14, 2025
@pjebs
Copy link
Contributor Author

pjebs commented Mar 14, 2025

I have to pass a build tag to go build , where the suffix of the tag name is dependent on the go version (including patch version).

$ go build -tag shrinkpkg$(go version --short) ...

Do you have a solution (that all main os and terminal apps can run)? The prior issue linked is not relevant and RSC says it was likely declined because he wanted a use-case.

@seankhliao
Copy link
Member

go env GOVERSION

@seankhliao seankhliao changed the title proposal: cmd/dist: add go version --short proposal: cmd/go: add go version --short Mar 14, 2025
@golang golang deleted a comment from Roxyfundz1 Mar 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants