撤消 go install 安装的包

代码编程
2024/04/10(更新于2025/10/24
预计阅读时长 1 分钟
如何删除 go install 安装的包

具体步骤

首先要明确需要删除的是哪个包,这里以 hello 为例,可以根据实际情况修改

  1. 使用 which 命令查看包路径
which hello

# output 
# /Users/fuxiaochen/go/bin/hello
  1. 使用 rm 令删除对应文件
rm -rf $(which hello)
  1. 再次执行命令,检查是否删除成功
hello

# output 出现 command not found 说明已删除
# command not found: hello

参考链接