Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/go: unexpected test cache hit of "PASS" when test should "FAIL" #30313
What version of Go are you using (
I tried to reproduce this, but I actually didn't see
As far as I understand,
I'll take a closer look tomorrow. There may not be an easy solution though.
This fails with:
I think I understand this now.
The difference between
So as far as the cache is concerned, after the source file change, the test binary is identical. A hash of the test binary is used to derive a cache key, which is used to look up a list of files the test accessed previously. None of the known input files have changed, so the cache test result is used.
Of course, the code in the "dead" function actually matters for this test, since it runs
I'm going to close this issue because the cache is working as designed here. I'm not sure the details of this are documented anywhere. #22593 seems to be where this was originally discussed. #23799 would probably be the right fix for this: this test would need to identify itself as uncacheable if there were a way to do so.
@jayconrod - that makes total sense, thanks.
Apologies, in this situation it's definitely a case of my error, so thank you for taking the time to look into this.
The usual pattern I follow for testing programs has a reference from
In this case, because the program I'm testing is a
The problem I'm seeing is easily solved by keeping such a reference form