为什么命令“ go clean -n -r -i github.com/ethereum/go-ethereum ...”不起作用?

时间:2018-09-18 05:27:36

标签: go go-ethereum

我所做的工作如下:

  1. Git克隆go-ethereum项目到我的本地PC。它位于 D:\ GOPATH \ src \ github.com \ ethereum \ go-ethereum。它是源代码 以太坊

    注意:操作系统为Windows7。已经安装了Go。并且GOPATH env已经设置为“ D:\ GOPATH”

  2. cd / d D:\ GOPATH \ src \ github.com \ ethereum \ go-ethereum。然后执行 “开始安装”。一些exe文件在D:\ GOPATH \ bin下生成 目录,并在下生成了许多后缀为.a的pkg文件 D:\ GOPATH \ pkg目录。一切似乎都没问题。

  3. 执行“ go clean -n -r -i github.com/ethereum/go-ethereum ...” 删除所有生成的exe文件和.a文件。但是非常 有趣的事情发生了:

在命令日志中,它显示了一些文件已删除,但实际上并未从磁盘中删除。

例如,event.a存在于D:\ GOPATH \ pkg \ windows_amd64 \ github.com \ ethereum \ go-ethereum下,但日志“ git clean”显示为:“ rm -f D:\ GOPATH \ pkg \ windows_amd64 \ github.com \ ethereum \ go-ethereum \ event.a“

详细信息在所附图像中。

这很奇怪。日志与实际结果不符:

一小段go clean命令如下(由于日志中有1300行以上,因此我无法全部粘贴):

  

cd D:\ GOPATH \ src \ github.com \ ethereum \ go-ethereum \ event
  rm -f event.test event.test.exe
  rm -f D:\ GOPATH \ pkg \ windows_amd64 \ github.com \ ethereum \ go-ethereum \ event.a
  cd D:\ GOPATH \ src \ github.com \ ethereum \ go-ethereum \ common \ mclock
  rm -f mclock.test mclock.test.exe
  rm -f D:\ GOPATH \ pkg \ windows_amd64 \ github.com \ ethereum \ go-ethereum \ common \ mclock.a
  cd D:\ GOPATH \ src \ github.com \ ethereum \ go-ethereum \ vendor \ github.com \ aristanetworks \ goarista \ monotime
  rm -f monotime.test monotime.test.exe
  rm -f D:\ GOPATH \ pkg \ windows_amd64 \ github.com \ ethereum \ go-ethereum \ vendor \ github.com \ aristanetworks \ goarista \ monotime.a
  cd D:\ GOPATH \ src \ github.com \ ethereum \ go-ethereum \ accounts \ abi
  rm -f abi.test abi.test.exe
  rm -f D:\ GOPATH \ pkg \ windows_amd64 \ github.com \ ethereum \ go-ethereum \ accounts \ abi.a
  cd D:\ GOPATH \ src \ github.com \ ethereum \ go-ethereum \ accounts \ abi \ bind
  rm -f bind.test bind.test.exe
  rm -f D:\ GOPATH \ pkg \ windows_amd64 \ github.com \ ethereum \ go-ethereum \ accounts \ abi \ bind.a

但是一些文件仍然存在:

enter image description here

1 个答案:

答案 0 :(得分:-1)

正确的答案实际上是@Peter在评论中提供的。正如Peter所说:“ -n标志使clean打印将执行的删除命令,但不运行它们。”

我尝试使用“ -x”代替“ -n”,并且效果很好。谢谢彼得。但是您在答案部分中发布了答案,所以我必须在此处发布您的答案并关闭该问题。