I'm using Go 1.13.1, latest as of today.
I'm trying to completely remove a package that I installed with go get
from GitHub. The go clean -i <PACKAGE_NAME>
didn't seem to work, since there are files spread through, at least, these directories:
~/go/pkg/mod/github.com/<PACKAGE_NAME>
~/go/pkg/mod/cache/download/github.com/<PACKAGE_NAME>
~/go/pkg/mod/cache/download/sumdb/sum.golang.org/lookup/github.com/<PACKAGE_NAME>
Is there a way to clean everything without removing all that manually?
This is currently not supported. If you think about it: it may be the current module does not need it anymore, but there may be other (unrelated) modules on your system that may still need it. The module cache is "shared" between all the modules on your system; it can be shared because dependencies are versioned, and if 2 unrelated module refers to the same version of a module / package, it's the same and can be shared.
The closest is go clean
with -modcache
, but that removes the entire module cache:
The -modcache flag causes clean to remove the entire module download cache, including unpacked source code of versioned dependencies.