-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: accessing temp files invalidates test caching in module mode #29111
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
Comments
Change https://golang.org/cl/153639 mentions this issue: |
@rogpeppe, I'm not able to reproduce the issue from the information provided. https://golang.org/cl/153639 contains my attempt; could you have a look and see how it differs from the behavior of your example? |
I can reproduce the behaviour with the following:
|
Weirdly, although it's is a (very!) strict subset of what the original tests are doing, Go 1.11.2 doesn't cache the above example, so technically it doesn't exhibit the regression. :-\ |
Ah, the issue was that the example didn't remove the directory afterwards. I've adjusted the example so it removes the directory afterwards, which does exhibit the regressive behaviour. |
Thanks, that example does the trick (modulo adding the missing |
Change https://golang.org/cl/154100 mentions this issue: |
Tangential comment: the link above should link to https://go-review.googlesource.com/c/go/+/154100 but it actually points to the unrelated https://codereview.appspot.com/154100, an issue from 2009! |
Hi there, is there a workaround (even if ugly) here? We have lots of tests that create temporary files and it would be good to know a way to be able to get them to cache. Is the solution here related to #29430? |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputOn a rather large closed source program, when using go1.11.2, if I run
go test .
, I see that the test has been cached. Using the same code and go tip, the tests are never cached.With go1.11, if I pass the
-test.testlogfile
arg to the test binary, the difference in the testlog file when running each test is this:With tip, the difference is:
A sample testlog output file on go1.11 is:
For tip, the testlog output looks like this:
Note that all the files in /tmp are only created for the duration of the test.
The text was updated successfully, but these errors were encountered: