如何从$GOPATH/bin中卸载所有内容?

huangapple go评论101阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2021年9月23日 08:50:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/69292741.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定