-
Notifications
You must be signed in to change notification settings - Fork 1k
Unclear why dep ensure -add adds a constraint #1313
Comments
A related thing I'm confused on is: should I have constraints pinning the major version of everything I use directly? If so, why doesn't |
you could operate that way - @nathany made an argument for an approach that scarcely used and that's generally why we've leaned away from recommending that route - it's can make updates a lot crazier. that's particularly the case when, say, you have A -> B -> C and A -> D -> C, B and D don't agree on C very well, but there's some really old version of B that doesn't require C at all. without constraints to guide it away from that super old version, dep will likely end up picking the very old version of B. version constraints can do a lot to help narrow the field. that, and because we've tried to dep in such a way that your use of it for "binary" vs. "lib" projects is basically the same - we, intentionally, do not distinguish between these.
so right, the above is why we append the constraint: it's based on the observation that the version we happened to grab just now is the first version that's guaranteed to have all the things you might use from that dependency. so, we stick it in |
Ok, so it was the other way around: I should always use The final piece here was:
To be fair, the README says to just use I think the Maybe even explicitly say "you could have imports w/o constraints, but that might make your updates weird, don't do that". |
(Thanks for the patient explanations, @sdboyer.) |
I'm trying to build a mental model of what I expect dep to do, and where I'm at is approximately:
dep ensure -update
dep ensure && dep prune
to make sure all is right in the worldSo from this worldview I would expect my toml file for a binary to be empty most of the time.
But then I want to vendor a package before using it, so I go to the README and I'm told to use
dep ensure -add
. Ok.But now I have a constraint in my toml file! Why? Am I not supposed not to have any?
So I go to the issue tracker and search for wisdom, and I find #1054 (comment) which actually makes me feel like my understanding is mostly correct, but then why does
dep ensure -add
add a constraint?So I'm confused.
The text was updated successfully, but these errors were encountered: