You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ReadIndex: when it fails to read a non-existent index,
it must return an error, since it did not complete its
task; (nil, nil) is not acceptable. Document this,
and fix all callers to handle the ErrNotExist case
specially if necessary.
Also:
- use a collision-resistant hash (SHA256, not CRC32) when
choosing a unique filename for each GOMODCACHE value.
- Remove the special test-only logic in modcacheState.getIndex
to call modindex.Create and retry. That's the tests' problem.
- Three integration tests needed rather subtle changes to add
"happens before" edges to populate GOMODCACHE before
building the index, and building the index before
invoking OrganizeImports (since it is fundamentally
asynchronous):
1 misc.TestGOMODCACHE
2 misc.TestRelativeReplace (renamed to TestIssue67156
since the old name was a red herring)
3 diagnostics.Test_issue38211
The purpose of each of the steps in the three tests
was also clarified.
- Fix a bug in WithProxy: if the module cache is derived
from a test's TempDir, it may contain "#" which has
special meaning in GOPROXY. Now we report an error.
The workaround is to use a fresh subtest, whose name
will not contain "#".
- Fix a bug in Sandbox.Close when it is called on a
partially constructed sandbox.
- Move CleanModCache into env package so it can be
shared. Also flag a couple of related problems in
comments that refer to it.
- Link to new issues for existing unsolved mysteries
encountered during testing.
- Eliminate Create from public API; it's not needed.
- Make Update and Read return the current index; this
avoids the need for redundant Update+Read sequences.
- modcacheindex no longer returns (nil, nil).
- len(Entries)==0 is no longer a special case.
- fix bug in modcacheTimed where len(new.Entries)==0
was erroneously used to mean "no change".
- Rename Index.Changed to ValidAt, since it doesn't
mean anything was actually changed at that time.
- Record only the "best" directory for each import path,
instead of a list, which must then be sorted.
- Don't store symbols in "directory" type; it's now
just an immutable triple value.
- Ensure that modcacheState.getIndex updates s.index.
The lack of updates in the previous code looked like an
oversight.
- Simplify "region" type away.
- Log unexpected ReadIndex failures.
- Rename dir, cachedir -> gomodcache throughout for clarity.
- Eliminate an unnecessary path segment from IndexDir, and
initialize it inline.
- Better error hygiene.
- Improve variable names, and eliminate unnecessary ones.
- Improve commentary.
- Make tests external, expressed using public API.
Updates golang/go#74055
Change-Id: I3648d2cbd0dc3e169564f6c0dc122d223966b4c0
Reviewed-on: https://go-review.googlesource.com/c/tools/+/682717
Reviewed-by: Robert Findley <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
// the problem is benign if filesByModule is empty.
33
+
ifstrings.Contains(tmpdir, "#") {
34
+
return"", fmt.Errorf("WriteProxy's tmpdir contains '#', which is unsuitable for GOPROXY. (If tmpdir was derived from testing.T.Name, use t.Run to ensure that each subtest has a unique name.)")
0 commit comments