tools / godep

dependency tool for go
http://godoc.org/github.com/tools/godep
BSD 3-Clause "New" or "Revised" License
5.54k stars 455 forks source link

Remove no longer needed dependencies #478

Open tobstarr opened 8 years ago

tobstarr commented 8 years ago

I used to work with import path rewriting with godep and I recenlty switched to storing my dependencies in vendor.

I guess (not 100% sure) godep also took care of removing dependencies which I no longer used in my code from the workspace but it seems this is no longer the case? I could not find anything in the README regarding this functionality. How can I do that cleanup (besides deleting Godep/Godeps.json and vendor and and running godep save again)?

freeformz commented 8 years ago

Thanks for the report!

I don't think there is a test for that. I'll check and add one if there isn't and see if I can get it passing.

The easiest way to do this atm is:

$ godep restore -v
$ rm -rf Godeps vendor
$ godep save <pkg spec>
$ git commit -av

The restore downloads and checks out your project's deps into $GOPATH. This makes it so that when you save again you get the same version of the deps re-saved. Anything that is no longer necessary won't be saved. Also any new tweaks to the save process are applied if you are using the latest godep (perms, stricter package matching, etc). I suggest upgrading to the latest version of godep before doing any of this.

kevinburke commented 8 years ago

It would also be nice to have this info in the README next to "[Add/Update] a Dependency"

HuKeping commented 8 years ago

How's this going?