-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: global go get does not reference main package's module's go.sum #37225
Comments
This is closely related to #28802, which was withdrawn. The default |
Thanks @bcmills
Indeed. My description above was inaccurate ("blindly accepting whatever it sees") - thanks for the correction. My asking this question is in the context of whether a Hence it seemed logical (to me at least!) to use the main package's module's The extent to which either of these points are a problem, though, is not totally clear to me. Hence I raised this issue more for discussion. |
Ah, that is a different (and also interesting) question!
(But I think that observation probably belongs on #30515, since absent an explicit “global install” flag we would like |
Per Slack, I don't even know what name to give this mode:
So for the purposes of what follows, I will refer to it as "mode Y" of
I guess my point is that in "mode Y" the user is blind to the fact that a temporary module is being created, used and then thrown away. So they are also blind to the fact that the step is potentially not reproducible.
Indeed, there's definitely overlap with that discussion. Per my comment above, I suppose I'm not really clear what "mode Y" is useful for, or whether we should be advising people to rely on/use it.
We could even use the main module's non-directory
Agreed. This issue was about the On that very point, is there some documentation somewhere that describes what happens in "mode Y"? Per my Slack message, I couldn't find any. |
We've been using the term “module mode outside of a main module” for “mode Y”, but that is admittedly pretty verbose. The behavior outside of a module is not very thoroughly documented at this point because it has been in flux (#24250 in 1.12, #32027 in 1.14, perhaps #30515 in 1.15 if we can straighten out the semantics, maybe #36513 at some point). It probably still needs some fine-tuning, so we certainly appreciate the input! |
For what it's worth, there is a degree of per-machine reproducibility because the tree head of the checksum database which is stored in “Module mode outside of a main module” can't get any better than that I suspect, because there is no way to verify the |
I believe with the introduction of |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
The current advice for globally installing a tool is some variant of:
The following command sequence succeeds:
However the following command sequence does not:
It fails with:
(an error I have deliberately introduced)
What did you expect to see?
Given we are installing a tool outside of a module context, have no
go.{mod,sum}
and hence are relying on a temporary module, part of me is not surprised by this behaviour.However I think it's problematic. It feels like the default advice for installing tools globally should use some
go.sum
reference when installing said tool, rather than blindly accepting whatever it sees. In this case it could use thego.sum
that is part of thegithub.com/myitcvscratch/badmain
module.Arguably
go get
's of this sort should fail if either thego.mod
orgo.sum
is incomplete, but that's perhaps another issue.What did you see instead?
As above.
The text was updated successfully, but these errors were encountered: