Go: Broken builds: build cache is disabled by GOCACHE=off, but required as of Go 1.12

Created on 21 Dec 2018  ·  6Comments  ·  Source: golang/go

All the builds break because of this change:

build cache is disabled by GOCACHE=off, but required as of Go 1.12

https://travis-ci.org/purpleidea/mgmt/jobs/470949378#L1610

All the specific info is available here.

We use this variable because it stops the tests from being cached. We do NOT want test results cached ever! We want to re-run the tests when we run go test.

Priority: critical
Blocker: 1.12

FrozenDueToAge

Most helpful comment

You can use GOFLAGS="-count=1".

From https://tip.golang.org/cmd/go/#hdr-Environment_variables :

    A space-separated list of -flag=value settings to apply
    to go commands by default, when the given flag is known by
    the current command. Flags listed on the command-line
    are applied after this list and therefore override it.

All 6 comments

Thanks for the report.

This change is documented in the 1.12 release notes:

Build cache requirement

The build cache is now required as a step toward eliminating $GOPATH/pkg. Setting the environment variable GOCACHE=off will cause go commands that write to the cache to fail.

https://tip.golang.org/doc/go1.12#gocache

Regarding:

We use this variable because it stops the tests from being cached.

The idiomatic way to bypass test caching is to use -count=1; not to disable the build cache. I suggest you re-enable the build cache, as required by Go1.12, and use that to disable test caching.

Otherwise, you won't be able to use Go1.12.

The idiomatic way to bypass test caching is to use -count=1; not to disable the build cache. I suggest you re-enable the build cache, as required by Go1.12, and use that to disable test caching.

How do I set that in my .envrc ? Or is the solution to take away an upstream feature and make typing go test even longer?? It's already got an fqdn in there...

(.envrc just stores shell variables, so any normal env setting will work)

You can use GOFLAGS="-count=1".

From https://tip.golang.org/cmd/go/#hdr-Environment_variables :

    A space-separated list of -flag=value settings to apply
    to go commands by default, when the given flag is known by
    the current command. Flags listed on the command-line
    are applied after this list and therefore override it.

Closing because I don't think there is anything to do.

-count=1 looks like a hackish solution IMO. Its better clean testcache before running the test cases
go clean -testcache.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

myitcv picture myitcv  ·  3Comments

natefinch picture natefinch  ·  3Comments

michaelsafyan picture michaelsafyan  ·  3Comments

gopherbot picture gopherbot  ·  3Comments

ashb picture ashb  ·  3Comments