Completely remove a package installed with “go get”?

随声附和 提交于 2020-02-26 02:16:34

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/58224679/completely-remove-a-package-installed-with-go-get

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!