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

cmd/go: "invalid version" error on get is unnecessarily repetitive #44810

Open
mvdan opened this issue Mar 5, 2021 · 5 comments
Open

cmd/go: "invalid version" error on get is unnecessarily repetitive #44810

mvdan opened this issue Mar 5, 2021 · 5 comments
Labels
help wanted NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@mvdan
Copy link
Member

mvdan commented Mar 5, 2021

$ go version
go version devel +2217e89ba3 Fri Mar 5 09:24:34 2021 +0000 linux/amd64
$ go get -d mvdan.cc/garble@branch/with/slash
go get: mvdan.cc/garble@branch/with/slash: invalid version: version "branch/with/slash" invalid: disallowed version string

The error line really doesn't have to be that long, especially given how it's repeating essentially the same three times.

Plus, it doesn't tell me why the version is disallowed. I had this happen with a name like feat/foo-bar and I had to think twice about what character it was upset about.

How about:

go get: mvdan.cc/garble@branch/with/slash: invalid version "branch/with/slash": version strings can't contain '/'
@mvdan
Copy link
Member Author

mvdan commented Mar 5, 2021

Actually, the version is earlier in the message too, so that is also repeated. We can make it even less repetitive:

go get: mvdan.cc/garble@branch/with/slash: invalid version: version strings can't contain '/'

@mvdan
Copy link
Member Author

mvdan commented Mar 5, 2021

I get that there are probably 5+ layers in this error message, but hopefully with error wrapping one could teach go get to remove the redundant layers.

@bcmills
Copy link
Contributor

bcmills commented Mar 5, 2021

Error-wrapping is hard. 😞
(https://github.com/bcmills/go-experience-reports/blob/master/errors.md)

@bcmills bcmills added help wanted NeedsFix The path to resolution is known, but the work has not been done. labels Mar 5, 2021
@bcmills bcmills added this to the Backlog milestone Mar 5, 2021
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/299150 mentions this issue: cmd/go: Remove unnecessarily repetitive from 'go get'

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/299132 mentions this issue: module: Remove unnecessarily repetitive from 'go get'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants