繁体   English   中英

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

[英]Why command “go clean -n -r -i github.com/ethereum/go-ethereum…” does not work?

我所做的步骤如下:

  1. 将Git clone go-ethereum项目复制到我的本地PC。 它位于D:\\ GOPATH \\ src \\ github.com \\ ethereum \\ go-ethereum中。 这是go-ethereum的源代码

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

  2. cd / d D:\\ GOPATH \\ src \\ github.com \\ ethereum \\ go-ethereum。 然后执行“开始安装”。 在D:\\ GOPATH \\ bin目录下生成了一些exe文件,而在D:\\ GOPATH \\ pkg目录下生成了许多带后缀.a的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

但是其中一些文件仍然存在:

在此处输入图片说明

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM