Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: go clean -testcache fails if GOCACHE directory does not exist #29100

Closed
mxk opened this issue Dec 4, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@mxk
Copy link

commented Dec 4, 2018

What version of Go are you using (go version)?

$ go version
go version go1.11.2 darwin/amd64

Does this issue reproduce with the latest release?

Yes. It may be affected by #26794 for 1.12, but looking at the code, I think the bug is still there.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOBIN="/Users/mxk/bin"
GOCACHE="/Users/mxk/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/mxk/.go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.11.2/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.11.2/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/xg/rnkm_hgs5298dsx212f1_y2c0000gp/T/go-build752263492=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

cachedir=$(go env GOCACHE)
mv $cachedir $cachedir.old
go clean -testcache
mv $cachedir.old $cachedir

What did you expect to see?

No errors and an exit code of 0.

What did you see instead?

go clean -testcache: open /Users/mxk/Library/Caches/go-build/testexpire.txt: no such file or directory
exit code 1

The -testcache flag assumes that the cache directory exists. When that's not the case, there is nothing to clear, so the command should exit normally.

@mxk mxk changed the title go clean -testcache fails if GOCACHE directory does not exist cmd/go: go clean -testcache fails if GOCACHE directory does not exist Dec 4, 2018

@agnivade

This comment has been minimized.

Copy link
Member

commented Dec 5, 2018

/cc @bcmills

@agnivade agnivade added this to the Go1.13 milestone Dec 5, 2018

@bcmills

This comment has been minimized.

Copy link
Member

commented May 29, 2019

I believe this was fixed by #28680. Please reopen if you can still reproduce it at head.

example.com$ gotip env GOCACHE
/tmp/tmp.pCKjol3k6h

example.com$ rm -r $(gotip env GOCACHE)

example.com$ gotip clean -testcache

@bcmills bcmills closed this May 29, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.