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 clean -testcache does not clean test cache #29757

Closed
tendervittles opened this issue Jan 15, 2019 · 1 comment
Closed

cmd/go clean -testcache does not clean test cache #29757

tendervittles opened this issue Jan 15, 2019 · 1 comment

Comments

@tendervittles
Copy link

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

$ go version
go version go1.12beta2 linux/amd64

Does this issue reproduce with the latest release?

Yes

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

go env Output
$ go env

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/tendervittles/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/tendervittles/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/other/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/other/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build703925793=/tmp/go-build -gno-record-gcc-switches"

The only slightly non-standard env is GOROOT="/usr/local/other/go". I use this when testing betas and release candidates.

What did you do?

I created a silly test, ran it twice, and saw the result was cached. Then I cleaned the test cache and ran a third time. The test result was still cached.

package silly

import (
	"testing"
	"time"
)

func TestSilly(t *testing.T) {
	time.Sleep(5 * time.Second)
}
$ go test silly_test.go
ok  	command-line-arguments	5.003s
$ go test silly_test.go
ok  	command-line-arguments	(cached)
$ go clean -testcache
$ go test silly_test.go
ok  	command-line-arguments	(cached)
$

However, clearing the entire cache does force a test run.

$ go clean -cache
$ go test silly_test.go
ok  	command-line-arguments	5.003s
$

What did you expect to see?

A test that took 5 seconds to run.

What did you see instead?

A cached test result.

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/158117 mentions this issue: cmd/go/internal/clean: fix clean -testcache does not clean test cache

@golang golang locked and limited conversation to collaborators Jan 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants