-
Notifications
You must be signed in to change notification settings - Fork 1k
it's hard to know what to do when inputs-digest in Gopkg.lock conflicts #1224
Comments
hi, welcome! interesting problem, this is the first time someone's raised this. to answer most effectively, i have to start with another question:
so, it's normal for some changes to produce inputs-digest changes: if you import a new package, drop all imports to a package, or change constraints in so, before i continue on with the rest of the answer - is that how you/your folks are using dep right now? 😄 if not, what are the sorts of changes that you're performing so regularly that result in the hash changes? |
I'm mostly referring to adding new packages, yeah. One person adds package X on a branch and in parallel another adds package Y. We're new to dep and haven't been doing much upgrading yet, just adding :) (As a separate issue, I am putting some |
OK, sounds like you're holding it right, then :) so, there actually isn't a terribly easy answer here, unfortunately. the however, that's really not a good solution. while it's quite unlikely, it's just not possible to guarantee that even though the rest of the note that i have been considering dropping the |
Yeah, I had just been setting it to a syntactically valid but wrong digest (other strings return an error) and running dep ensure and it fixed it. A comment or fake comment or FAQ entry saying "on conflict just delete the field and run dep ensure, it'll be ok" would be nice (if true). I saw this today which is clever but maybe more the kind of advanced thing that folks working on v5 of their tool have time for: https://twitter.com/maybekatz/status/914006850550370304 |
Oh hey, yarn too: yarnpkg/yarn#3544 |
oooooooh. fancy! i'm currently ribbing the npm folks for creating work for me 😜 i think it's not impossible that we could do that, though they get it for almost free because they already have a tree fixup phase, from what i understand. we don't have such a phase, and we need to create something like one in order to do it. i'd happily guide a PR that wanted to work on that 😄 |
Heh, that is probably beyond my capacities right now. On the other hand I'd be happy to try to do something simpler. And hey, our TOML lib just added the ability to write (static) comments a few days ago! From a quick skim, it looks like it is always safe (if perhaps not the best performance) to delete the inputs-digest line and re-run So what do you think about improving (Other things I noticed while investigating: errInputDigestMismatch should pluralize "input". The errors that were changed to warnings in #1225 are preceded by now-misleading comments claiming that we're still going to bail out.) |
I definitely agree with removing the inputs-digest from the lockfile. The fact that it's un-mergeable between unrelated feature branches makes it impossible to work on dependency changes in parallel, especially when changes are submitted as PRs. That's why similar examples like Gemfile.lock and Berksfile.lock don't include this. Instead, they generate files that will conflict only if the actual dependencies conflict. If this is needed, maybe it should be moved to a file or location that's not intended to be committed to version control. |
yes, we're definitely going to be removing the it will require writing several new verification routines as substitutes, though. those are likely to go hand-in-hand with the ideas outlined in this doc for a |
Basically every change to Gopkg.lock updates the solve-metadata.inputs-digest field. That means that whenever you're merging two changes that touch Gopkg.lock you're going to get a merge conflict.
It's not the end of the world, but it would be nice if there was more guidance for what to do when this happens. I assume the answer is basically just "resolve the conflict randomly, run
dep ensure
again" but I'm a little paranoid, like, what if choosing the wrong digest in my resolution means thatdep ensure
won't work (either crashing or incorrectly assuming that it doesn't have to do work due to a cache)? Maybe this is safe now but might get worse when some of the in-progress caching work fordep
is done?I think it would be great if the docs answered the question of what to do if you get an inputs-digest conflict. It would be even better if the file was self-documenting, with a comment above the inputs-digest line explaining how to resolve merge conflicts; I guess go-toml doesn't support adding comments, though I guess you could just add an otherwise ignored field whose value is effectively a comment.
Experienced with
dep
v0.3.1.The text was updated successfully, but these errors were encountered: