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

Open
mxk opened this Issue Dec 4, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@mxk

mxk 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 from go clean -testcache fails if GOCACHE directory does not exist to cmd/go: go clean -testcache fails if GOCACHE directory does not exist Dec 4, 2018

@agnivade

This comment has been minimized.

Member

agnivade commented Dec 5, 2018

/cc @bcmills

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment