Add purge command to detect unused vendor dependencies
I just updated my project and I no longer need one of the dependencies under the vendor/ directory since it's no longer imported. Is there a way to detect and/or remove vendor deps that are no longer needed?
Maybe something as simple as enhancing the gvt list output to show the dependencies grouped in two sections to call out the ones that aren't used by the code anywhere.
This would be also be useful when removing a dependency and having to figure out which transitive dependencies to remove. For example:
$ gvt list
github.com/alecthomas/kingpin https://github.com/alecthomas/kingpin master 46aba6af542541c54c5b7a71a9dfe8f2ab95b93a
github.com/alecthomas/template https://github.com/alecthomas/template master 14fd436dd20c3cc65242a9f396b61bfc8a3926fc
github.com/alecthomas/units https://github.com/alecthomas/units master 2efee857e7cfd4f3d0138cc3cbb1b4966962b93a
gopkg.in/alecthomas/kingpin.v2 https://gopkg.in/alecthomas/kingpin.v2 master 24b74030480f0aa98802b51ff4622a7eb09dfddd
If I remove github.com/alecthomas/kingpin via:
gvt delete github.com/alecthomas/kingpin
then I still have to go remove the transitive deps. In the above case they are easy to identify, but in other scenarios it seems like it might take some manual effort.
gb-vendor had a purge command. I should definitely introduce one for gvt.
And maybe delete should dry-run purge and print a message saying "X dependencies are not needed anymore, run purge to delete them", apt-get style.
@FiloSottile love gvt, except for this.. could we settle on something close or equivalent or the exact push as https://github.com/excavador/gvt/commit/f56d4308af3380e0f238794a0ac76c2399e2b526 :))
looks like a super old request and we might need this. thanks! cc/ @hixichen @samikshan