From e0f5493daaf40aacff74510c9f0bcab3fedb3dfc Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Mon, 12 Oct 2026 18:21:44 +0200 Subject: [PATCH] Answer product-owner round 1: the seed docs say a new seed each run, not draws afresh, the README says to log a drawn seed to replay a run, and the changelog names WithSeed and the data options apart --- CHANGELOG.md | 10 +++++----- README.md | 2 +- fejkdata.go | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 397cf3a..c0b7f08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,11 +27,11 @@ and any release may change what a seed draws, so pin one exact version error such as data that fails to load, and `2` on misuse. - The library, `github.com/larvit/fejkdata`, for Go 1.22 or later on a 64-bit target. `New` loads the modules `WithDataFS` names and the folders `WithDataPath` names, drawing - from the seed `WithSeed` gives, and fails naming each of `WithSeed` and `WithDataFS` - that is missing. The same seed repeats the draws while the version and data stay the - same. `Fake` renders a path, and `FakeTemplate` and `NewTemplate` render a - template. `FakeRecord`, `FakeRecordTemplate` - and `NewRecordTemplate` render a record, whose `JSON`, `CSVHeader`, `CSVLine` and + from the seed `WithSeed` gives. It fails naming `WithSeed` where no seed is given, and + `WithDataFS` where neither option names the data. The same seed repeats the draws + while the version and data stay the same. `Fake` renders a path, and `FakeTemplate` + and `NewTemplate` render a template. `FakeRecord`, `FakeRecordTemplate` and + `NewRecordTemplate` render a record, whose `JSON`, `CSVHeader`, `CSVLine` and `SQLInsert` methods write its columns as the CLI does. `FakeStruct` fills a struct's `fake:"…"` tagged fields. `List` gives the paths `Fake` renders, direct descents only, and `IsTemplate` tells an inline template from a path. Data that fails to load gives diff --git a/README.md b/README.md index 86ac9c9..4329256 100644 --- a/README.md +++ b/README.md @@ -360,7 +360,7 @@ ok, err := fejkdata.IsTemplate(arg) // an inline template by its shape, el | Option | | |--------|--| -| `WithSeed(n)` | required; same seed, version and data: identical sequence. `WithSeed(rand.Uint64())`, with `math/rand/v2`, draws afresh each run | +| `WithSeed(n)` | required; same seed, version and data: identical sequence. `WithSeed(s)` with `s := rand.Uint64()`, from `math/rand/v2`, takes a new seed each run; log `s` to replay a run | | `WithDataPath(dir)` | layer a directory; repeat to layer several, the last wins a clash | | `WithDataFS(modules...)` | layer modules in order, each an `fs.FS`: a shipped package's `Modules()...`, or your own `embed.FS`; `WithDataFS()` loads none | diff --git a/fejkdata.go b/fejkdata.go index 05f88a1..db8feb1 100644 --- a/fejkdata.go +++ b/fejkdata.go @@ -45,7 +45,7 @@ type Option func(*config) // WithSeed seeds the generator, as [New] requires: two generators with the same seed, // version and data emit identical sequences. WithSeed(rand.Uint64()), with math/rand/v2, -// draws afresh each run. +// takes a new seed each run. func WithSeed(seed uint64) Option { return func(c *config) { c.seed, c.seeded = seed, true } } @@ -75,7 +75,7 @@ func WithDataFS(modules ...fs.FS) Option { } } -var errNoSeed = errors.New(`fejkdata: no seed: add fejkdata.WithSeed(n) to repeat a run's output, or WithSeed(rand.Uint64()) (import "math/rand/v2") to draw afresh each run`) +var errNoSeed = errors.New(`fejkdata: no seed: add fejkdata.WithSeed(n) to repeat a run's output, or WithSeed(rand.Uint64()) (import "math/rand/v2") for a new seed each run`) var errNoData = errors.New(`fejkdata: no data: add fejkdata.WithDataFS(data.Modules()...) (import "github.com/larvit/fejkdata/data") for all shipped data, WithDataFS/WithDataPath for your own, or WithDataFS() for none`)