英文:
How to uninstall everything from $GOPATH/bin?
问题
go clean -i
命令在某个项目中运行时会删除之前由go install
命令安装的该项目的可执行文件。如何删除从多个不同项目中运行的go install
命令安装的所有内容?是否有某个单一的go
命令可以做到这一点?
英文:
The go clean -i
command that is ran inside some project deletes an executable file of that particular project that was previously installed by go install
command. How to delete everything installed by the go install
commands that were ran from several different projects? Is there some single go
command that can do that?
答案1
得分: 2
TL;DR
像删除其他文件一样删除二进制文件。
"install"一词表示将某物放置在新位置以供使用。
因此,Go会构建一个单文件二进制文件,并将其放置在另一个目录($GOPATH/bin
)中。当你将Go二进制目录添加到环境变量中以调用程序时,这非常有用。
在Go 1.16.4中,没有像go clean -bincache
这样的辅助标志来删除所有由Go 1.16.4安装的二进制文件。
然而,在当前版本的GoLang(1.16.4)中,删除(或者像你说的“卸载”)任何已安装的二进制文件的正确方法就是像删除其他文件一样将其删除,尽管你可能觉得这听起来有些奇怪。
英文:
TL;DR
Delete the binary like any other file.
The "install" term means place (something) in a new position ready for use.
Therefore, Go builds a single-file binary and places it in another directory ($GOPATH/bin
). It is useful when you add the Go binary directory into the environment variable to call the program.
There's no auxiliary flag such as go clean -bincache
to remove all binaries installed by Go 1.16.4.
However, at the current version of GoLang (1.16.4), the right way to remove (or "uninstall" as you said) any installed binary is solely to delete it, like any other file despite you feel it sounds awkward.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论