Skip to content

Feat/codebase improvements#13

Merged
Splode merged 5 commits intomainfrom
feat/codebase-improvements
Mar 3, 2026
Merged

Feat/codebase improvements#13
Splode merged 5 commits intomainfrom
feat/codebase-improvements

Conversation

@Splode
Copy link
Owner

@Splode Splode commented Mar 3, 2026

Bug fixes, library improvements, and word list quality

Bug fixes

  • Seed sentinel value removed — --seed -1 previously silently fell back to random generation because -1 was used as the "no seed provided" sentinel. The flag now uses pflag.Lookup("seed").Changed to distinguish an explicit seed from an absent one, making all int64 values valid seeds.
  • Spurious collision-avoidance loop removed — Generate() retried the noun index whenever it equalled the adjective index, on the assumption this prevented duplicate words. It didn't: the indices are into different-sized arrays and equal integers don't mean equal words. The loop is gone.
  • Size validation is now eager — WithSize returns (GeneratorOption, error) instead of a silent no-op option. Invalid sizes fail at construction time rather than surfacing as an error on the first Generate() call.

New features

  • --format / -f flag — CLI now supports --format json to emit all names as a JSON array (["name1","name2"]), useful for scripting. Default behavior is unchanged (plain).
  • WithDictionary and NewCustomDictionary — Library callers can now supply custom word lists. NewCustomDictionary(adjectives, adverbs, nouns, verbs []string) builds a Dictionary with per-category overrides; nil slices fall back to the embedded defaults. Fulfills a long-standing TODO.
  • --quantity validation — Passing --quantity 0 or a negative value now exits with a clear error instead of silently producing no output.

Library API

  • ParseCasing added — Replaces CasingFromString as the canonical name (idiomatic Go convention for string parsing). CasingFromString is kept as a deprecated alias.

Performance

  • split() in dictionary.go replaced bufio.Scanner on in-memory strings with strings.Split — simpler and avoids unnecessary reader allocation.
  • applyCasing replaces a map[Casing]func lookup with a switch — zero allocation, no hash overhead.

Word list quality

  • Verb tenses normalized: 169 past-tense and past-participle forms converted to 3rd-person singular present (e.g. abandoned → abandons, achieved → achieves). Net change: 448 → 419 verbs.
  • Adjective/noun overlap resolved: 72 words appeared in both lists. Each was removed from the less-appropriate list (e.g. cherry, copper, ruby removed from adjectives; blue, cold, dark removed from nouns). 2-word combination space: 4.65M → 4.51M — well above the stated floor.

CI

  • actions/setup-go updated v2 → v5; fixes 403 failures when downloading Go for macos-latest (ARM64) runners.
  • Matrix minimum Go version aligned with go.mod: ~1.17 → ~1.19.
  • Removed GO111MODULE: "on" (no-op since Go 1.16).

@Splode Splode merged commit 2a119a1 into main Mar 3, 2026
14 checks passed
@Splode Splode deleted the feat/codebase-improvements branch March 3, 2026 01:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant