Closed andrewstuart closed 7 years ago
Blinly checking out master isn't a good thing, but probably works in the 90% case. I'd argue that the appropriate place to fix this is to have go get
determine the remote head and check that out when not already on that branch when doing a go get -u
. godep already has logic to do that because it needs to check out the correct default head when updating to ensure the correct sha is present.
Also my goal, although I don't know if I'll ever get to it, is to remove the need to ever godep restore.
Thoughts?
Yeah, it'd definitely be nice to not need to run godep restore
, but I still think a generic foreach
command has the potential to be useful for one-offs and scripts, much as it is with git submodule foreach
.
I think it's just a nice side-effect that for now it does help the process of upgrading old Godeps/_workspace environments using godep restore; godep save; godep foreach git checkout master
.
I think this gives a very simple solution to #453 of simply running
godep foreach git checkout master
to fix any inconsistencies caused bygodep restore
. I'm sure it could be useful in other ways as well, and matches up well with thegit submodule foreach
paradigm.I'm sure there are other enhancements that could be made to this, so I'd be glad to go through the work to get it up to the necessary quality for inclusion. Let me know what I can do. :smile: