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: GOCACHE=false is not the same as GOCACHE=off #28290

Closed
poy opened this issue Oct 19, 2018 · 4 comments
Closed

cmd/go: GOCACHE=false is not the same as GOCACHE=off #28290

poy opened this issue Oct 19, 2018 · 4 comments

Comments

@poy
Copy link
Contributor

poy commented Oct 19, 2018

Please answer these questions before submitting your issue. Thanks!

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

go version
go version go1.11.1 darwin/amd64

Does this issue reproduce with the latest release?

Yes

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

go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/pivotal/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/pivotal/workspace/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/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/44/zr3txl1n45b23kd2kgx1xqq00000gn/T/go-build585099442=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

GOCACHE=false go test ./...

What did you expect to see?

go's test cache turned off

What did you see instead?

Left the cache on and created a folder named false. I've noticed several devs (including myself) expect type to be a bool instead of a more human readable value.

@ianlancetaylor ianlancetaylor changed the title GOCACHE=false is not the same as GOCACHE=off cmd/go: GOCACHE=false is not the same as GOCACHE=off Oct 19, 2018
@ianlancetaylor
Copy link
Contributor

Well, GOCACHE=off is documented. It's a special case. And every new value we treat as disabling the cache is another special case. It seems to me best to minimize special cases, meaning that we should stick to the current documented status.

On the other hand we could perhaps consider failing if GOCACHE is not off and is not an absolute path. It's hard to imagine a use for explicitly setting GOCACHE to anything other than an absolute path.

@poy
Copy link
Contributor Author

poy commented Oct 20, 2018

I would agree with the absolute path idea. That would at least surface the misconfiguration without creating an erroneous directory.

@agnivade
Copy link
Contributor

On the other hand we could perhaps consider failing if GOCACHE is not off and is not an absolute path.

I don't see a need to change GOCACHE to allow only absolute paths. Cases like GOCACHE=mycache are not that hard to imagine. There are other environment vars which take relative paths too.

And more importantly, with 1.12 GOCACHE=off is going to go away altogether. https://tip.golang.org/doc/go1.11#gocache. So doing something which is not going to be there anyways seems like wasteful.

@poy
Copy link
Contributor Author

poy commented Oct 20, 2018

I didn't realize it was being deprecated. I would agree then.

@poy poy closed this as completed Oct 20, 2018
@golang golang locked and limited conversation to collaborators Oct 20, 2019
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

4 participants