gvt icon indicating copy to clipboard operation
gvt copied to clipboard

Add purge command to detect unused vendor dependencies

Open tleyden opened this issue 9 years ago • 3 comments

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.

tleyden avatar Feb 09 '16 02:02 tleyden

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.

tleyden avatar Feb 09 '16 04:02 tleyden

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 avatar Feb 09 '16 10:02 FiloSottile

@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

arcolife avatar Jul 10 '18 22:07 arcolife