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: clarify error from 'go install' when arguments have mismatched versions and paths #51196
Comments
Thanks for the report. As far as I know this is working as intended, but one of @bcmills, @matloob, @jayconrod may have more up to date information, or link to a better existing source of past discussion. It's still possible to install arbitrary local commands with
Making it work for multiple modules at different versions was considered during the design of this feature, but it was decided that installing unrelated commands from different modules will need multiple I'll close this because the go command is working as intended and documented, but feel free to reopen or comment if I've missed something. |
@dmitshur Definitely I think the order of checks (same version and same module) should be reversed. Because right now the error message implies that if goimports and counterfeiter were coincidentally the same version then it would work, which makes it seem especially arbitrary. |
Hrm. We can tell that the versions are different in this case without doing any lookups on the network or in the module cache. I suppose that we could technically prove that the two packages are from separate modules in this case too, but in general that's trickier if their paths overlap. |
@bcmills Maybe as a simpler solution, the error can be changed to align with the statement from the docs: "all arguments must refer to packages in the same module at the same version". |
Change https://go.dev/cl/388154 mentions this issue: |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What did you do?
What did you expect to see?
It should install both binaries without issue.
What did you see instead?
This used to work in the pre-mod days - I could install multiple unrelated binaries from local paths without issue. This seems like an arbitrary and unnecessary restriction. I shouldn't need to run the
go
command multiple times.The text was updated successfully, but these errors were encountered: