简体   繁体   中英

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

What I did were as follows step by step:

  1. Git clone go-ethereum project to my local PC. It is located in D:\\GOPATH\\src\\github.com\\ethereum\\go-ethereum. It is the source code of go-ethereum

    Note: The OS is windows 7. Go has already been installed. And GOPATH env has already been set to "D:\\GOPATH"

  2. cd /d D:\\GOPATH\\src\\github.com\\ethereum\\go-ethereum. Then execute "go install". Some exe files were genereated under D:\\GOPATH\\bin directory, and many pkg file with suffix .a were generated under D:\\GOPATH\\pkg directory. Everything seems no problem.

  3. Execute "go clean -n -r -i github.com/ethereum/go-ethereum..." to remove all the generated exe files and .a files. But something very interesting happened:

In the command's log, it showed that some files are deleted, but actually they are not deleted from disk.

For example, event.a exists under D:\\GOPATH\\pkg\\windows_amd64\\github.com\\ethereum\\go-ethereum, but the log of "git clean" shows:"rm -f D:\\GOPATH\\pkg\\windows_amd64\\github.com\\ethereum\\go-ethereum\\event.a"

The detailed information is in the attached images.

It is very strange. The log does not match with the actual result:

A small segment of go clean command is as follows(since there are more than 1300 lines in log, I can not paste all of it):

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

But some of the files remain:

在此处输入图片说明

The correct answer is actually provided by @Peter in comment. As Peter said "The -n flag causes clean to print the remove commands it would execute, but not run them."

I tried "-x" instead of "-n", and it works well. Thanks Peter. But you posted your answer in comment section, so I have to post your answer here and close this question.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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