How do I remove unused dependencies with govendor

1.6k Views Asked by At

I want to cleanup my vendor folder in my golang project. What is the best way to go about this?

2

There are 2 best solutions below

1
Aki On

After good amount of looking around, I found that there is an easy one-line command to do this:

govendor remove +unused

0
Raul Lucaciu On

What about using this commands?

go mod tidy --> removes dependencies from go.mod 
go mod vendor --> removes libraries from vendor

This will remove all unused libraries