/ go Public
cmd/go,testing,doc: better information about debugging test cache failures #35301
help wanted NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
I'm trying to figure out why Go is not caching a test I wrote. First, after about 10-15 minutes of searching (including through old issues here) I could not find the flag to enable the debug output that shows you how Go builds its cache. Finally, I found it
I am trying to read through the output of
gocachehash=1but it's still not easy to figure out what is going wrong. The obvious first thing to do is to run the tests twice and then diff the output and see what's different. However, the output (about 10,000 lines) from two gocachehash runs prints out in different order each time so the diff is very large.
Next I tried sorting each output file and printing it. This yields a pretty manageable diff.
I repeated the same exercise with a test that printed out
(cached)to compare. The cached test diff also had
HASH ... /T/go-buildlines so I assume those are a red herring. That essentially leaves this diff:
However I am confused by this one as well because the content hash of the opened file is identical, so I'm not sure why Go is refusing to use the test cache.
Am I correct that these "stat" lines are the reason Go is not caching the result of this test? If so, what is the problem that is leading Go to not cache the results?
Can we build a tool to automate the process of debugging test hashes? E.g. run a test twice, capture the output, sort it, print the lines that differ.
The text was updated successfully, but these errors were encountered: