-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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/internal/envcmd: GOCACHE=off behavior difficult to debug #29243
Comments
see also #29251, it's concerning that this error message has appeared twice, which increases the likelihood (to me anyway) that a significant portion of the user base will hit it. |
On Darwin, the build cache requires either
That seems more likely. But we should certainly fix the diagnostics. |
FWIW, the diagnostic in this case is intended to read The logic for that is here, and seemed so trivial that I only tested one mode: go/src/cmd/go/internal/cache/default.go Lines 74 to 83 in 47fb1fb
Obviously I should have tested more thoroughly. 🙂 |
Are we committed to not letting users build code unless they set $HOME or $GOCACHE? I'd expect this to break quite a few Docker images, which probably didn't want to keep the cache around anyway. Also, I run some machines with a read-only $HOME, which I guess won't be able to build Go code anymore. It already broke tip.golang.org and stuff inside Google, too. |
It's what we announced in the 1.11 release notes, and nobody complained about it then. We could perhaps put the cache in |
At any rate, that seems like a separate issue from the broken diagnostic message. |
Apologies for not complaining, I guess I didn’t realize the implications. I
compile from tip daily and just noticed it now
On Fri, Dec 14, 2018 at 18:44 Bryan C. Mills ***@***.***> wrote:
At any rate, that seems like a separate issue from the broken diagnostic
message.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#29243 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAOSI9PaxaLmLPhn3XD-j4eg_CsdVHKeks5u4_F3gaJpZM4ZSsld>
.
--
Kevin Burke
phone: 925.271.7005 | kev.inburke.com
|
Opened #29267. |
Change https://golang.org/cl/154309 mentions this issue: |
Just started seeing this in all my travis builds. Which broke everything! I set this variable in my |
You can always disable test caching by using the |
Change https://golang.org/cl/163798 mentions this issue: |
Go 1.12 has been released¹ and should be used, so that it's possible to play with Go programs that rely on Go 1.12-only features. In Go 1.12, build cache is required. Either GOCACHE must be set, or HOME must be set so that GOCACHE can be implicitly deduced. Set HOME and pass it on to the go build invocation inside the compileAndRun function. This fixes the following error, detected by the playground test: 2019/02/26 06:28:44 compile error: build cache is required, but could not be located: GOCACHE is not defined and neither $XDG_CACHE_HOME nor $HOME are defined The command '/bin/sh -c /app/playground test' returned a non-zero code: 1 This is related to issues golang/go#29243 and golang/go#29251, and the fix in CL 154181. ¹ https://groups.google.com/d/msg/golang-announce/Y1RZqnCKUKY/N9yK5c8iBgAJ Fixes golang/go#30397 Change-Id: I44c5c8928060732f31fd935b114568258c7298c7 Reviewed-on: https://go-review.googlesource.com/c/163798 Reviewed-by: Brad Fitzpatrick <[email protected]>
Please answer these questions before submitting your issue. Thanks!
What did you do?
I have a test that calls
go build
with the following code:Compiling with
tip
this failed first with the error "exit status 1", then when I printed out the stdout/stderr I got:This was very confusing because I double and triple checked the env vars and the source code and I never referred to GOCACHE.
Finally, by editing the
cmd/go
source code and recompiling I was able to determine the actual problem was that I was not passing through the$HOME
variable, soos.UserCacheDir()
was failing, andcmd/go/internal/cache/default.go:DefaultDir
was returning an error.$HOME
is not a requirement to use the build cache on Go 1.11, or, perhaps this test program was failing to hit the build cache in Go 1.11 and it was not an error.This is concerning because we should not expect the average Go user to recompile the Go command to determine what is wrong with their program.
It would be good to provide an error message that lets the user better debug what is wrong with their program and how/why GOCACHE is being set to
off
in the build environment.Does this issue reproduce with the latest release (go1.11.2)?
No
System details
The text was updated successfully, but these errors were encountered: