diff options
| author | Michael Matloob <matloob@golang.org> | 2024-01-30 13:42:43 -0500 |
|---|---|---|
| committer | Michael Matloob <matloob@golang.org> | 2024-02-06 18:18:13 +0000 |
| commit | 13788923a55e9f3fce42a06e3dbed8d7796ccc5b (patch) | |
| tree | fedf3e79adbcdfcc1db9c017d564fc06be94e6e0 /internal/fetchdatasource/fetchdatasource_test.go | |
| parent | f26e1ab5cf5bf4cbc49868e8ff3e37b54bc89acb (diff) | |
| download | go-x-pkgsite-13788923a55e9f3fce42a06e3dbed8d7796ccc5b.tar.xz | |
internal/fetch: split FetchModule in two
First we get a LazyModule that essentially just contains the UnitMetas
for each of the modules and then we process each Unit as needed so
that FetchDataSource doesn't need to process all the Units when it
just needs one. To construct at FetchResult, FetchModule will now get
a LazyModule and then compute all the Units.
A compromise to get this to work is that FetchDataSource will no
longer populate Synopsis, IsRedistributable and Licenses on
Subdirectories to avoid computing all those fields for all units when
returning a single unit.
MainVersion and MasterVersion are removed from FetchResult because
they were only set on the internal/worker.FetchTask struct that embeds
a FetchResult.
Change-Id: Ia0db850ae570d421712ec484ee8b7815a779128e
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/557818
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
kokoro-CI: kokoro <noreply+kokoro@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Diffstat (limited to 'internal/fetchdatasource/fetchdatasource_test.go')
| -rw-r--r-- | internal/fetchdatasource/fetchdatasource_test.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/internal/fetchdatasource/fetchdatasource_test.go b/internal/fetchdatasource/fetchdatasource_test.go index 53bca653..05cb121a 100644 --- a/internal/fetchdatasource/fetchdatasource_test.go +++ b/internal/fetchdatasource/fetchdatasource_test.go @@ -560,13 +560,13 @@ func TestBuildConstraints(t *testing.T) { func TestCache(t *testing.T) { ds := Options{}.New() - m1 := &internal.Module{} + m1 := &fetch.LazyModule{} ds.cachePut(nil, "m1", fetch.LocalVersion, m1, nil) ds.cachePut(nil, "m2", "v1.0.0", nil, derrors.NotFound) for _, test := range []struct { path, version string - wantm *internal.Module + wantm *fetch.LazyModule wante error }{ {"m1", fetch.LocalVersion, m1, nil}, |
