aboutsummaryrefslogtreecommitdiff
path: root/internal/testing/fakedatasource/fakedatasource.go
diff options
context:
space:
mode:
authorEthan Lee <ethanalee@google.com>2026-03-11 21:00:08 +0000
committerGopher Robot <gobot@golang.org>2026-03-19 11:14:09 -0700
commitab4b6a99d7828154fc803870bbb2f18835d6470b (patch)
tree5c0613956d2f6498d2cb4d5e38d69b80ebe6f9ba /internal/testing/fakedatasource/fakedatasource.go
parent6d0faac5e074a8a4e101da820e7e21a8a6c2ff2d (diff)
downloadgo-x-pkgsite-ab4b6a99d7828154fc803870bbb2f18835d6470b.tar.xz
internal/api: implement module metadata endpoint
Change-Id: Id6b8686012803c88c9b7ea71e4b1c0058b7967b0 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/754861 Auto-Submit: Ethan Lee <ethanalee@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> kokoro-CI: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'internal/testing/fakedatasource/fakedatasource.go')
-rw-r--r--internal/testing/fakedatasource/fakedatasource.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/internal/testing/fakedatasource/fakedatasource.go b/internal/testing/fakedatasource/fakedatasource.go
index 1f695196..754a00cb 100644
--- a/internal/testing/fakedatasource/fakedatasource.go
+++ b/internal/testing/fakedatasource/fakedatasource.go
@@ -234,9 +234,17 @@ func findUnit(m *internal.Module, path string) *internal.Unit {
return nil
}
-// GetModuleReadme is not implemented.
+// GetModuleReadme gets the readme for the module.
func (ds *FakeDataSource) GetModuleReadme(ctx context.Context, modulePath, resolvedVersion string) (*internal.Readme, error) {
- return nil, nil
+ m := ds.getModule(modulePath, resolvedVersion)
+ if m == nil {
+ return nil, derrors.NotFound
+ }
+ u := findUnit(m, modulePath)
+ if u == nil {
+ return nil, nil
+ }
+ return u.Readme, nil
}
// GetLatestInfo gets information about the latest versions of a unit and module.