embed blogs.json instead of fetching it at runtime (closes #1)

The dataset is vendored as blogs.json and compiled in with go:embed, so
the package does no network I/O on any code path.

FetchBlogs is removed rather than kept as a no-op wrapper, since nothing
is fetched any more: GetBlogs decodes the embedded bytes on first call
and memoizes the result, and RandomBlog, RandomBlogs and NthBlog go
through it. Callers of FetchBlogs have to switch to GetBlogs.

make update-data refreshes the vendored copy from the BlogsURL constant,
downloading to a temporary file and replacing blogs.json only once that
file parses as a non-empty JSON array of blog entries, so a
complete-but-wrong response cannot overwrite the good dataset. A test
walks the dependency graph of the non-test build and fails if any net/*
package is reachable.

Model: opus-5
This commit is contained in:
2026-09-05 03:08:25 +00:00
parent 44b915c54b
commit 7e1b010c4f
6 changed files with 248449 additions and 45 deletions

248260
blogs.json Normal file

File diff suppressed because it is too large Load Diff