Files
rgoue/TODO.md
sneak 5ba9fe8f66 Adopt house golangci-lint config; fix all approved-linter findings
.golangci.yml is the prompts-repo standard verbatim plus one approved
exception (paralleltest, sneak 2026-07-06). Roughly 1,500 findings
fixed:

- autofix sweep (wsl_v5/nlreturn/intrange/modernize formatting), with
  the misspell autofix REVERTED where it rewrote authentic C game text
  ("missle vanishes" stays, with nolint and a comment)
- error handling: errcheck sites get real handling — saveFile now
  closes explicitly and removes corrupt saves, scoreboard writes are
  documented best-effort, err113 sentinel errors (ErrSaveOutOfDate,
  ErrScreenTooSmall); panics allowed for unrecoverable states per
  MEMORY.md policy
- gosec: real fixes (ParseInt for SEED, 0600 scorefile) and justified
  per-line nolints for provably-bounded conversions (randomMonsterLetter
  helper collapses eight rnd(26)+'A' sites)
- API tidying from linters: pointer receivers on flag types
  (recvcheck), msg helpers renamed addmsgf/doaddf/Printwf/MvPrintwf
  (goprintffuncname), myExit()/findFloor(monst)/mkGameInput(t) drop
  always-constant params (unparam), gameEnd carries no status
- gocritic/staticcheck: if-else chains to switches, the pack.c
  inventory filter untangled into matchesFilter, main.go split so
  defers run before exit (exitAfterDefer, funlen)
- revive doc comments on all exported flag types/consts/methods

Remaining findings are confined to linters pending sneak's exception
decision (mnd, gochecknoglobals, cyclop, nestif, gocognit, exhaustive,
goconst, testpackage); TODO.md records the state. MEMORY.md added at
repo root as the project's agent working notes.
2026-07-07 00:03:45 +02:00

6.7 KiB

Workflow

  • branch (from main)
  • do the work in Next Step
  • move Next Step to the top of Completed Steps
  • move the top item of Future Steps into Next Step
  • commit (TODO.md changes in the same commit as the work)
  • merge to main if the branch is not protected, otherwise open a PR
  • push

Status

pre-1.0

The port on main is complete and faithful (function-by-function from Rogue 5.4.4 C; reference sources on c-master/modern-rogue). Current phase: refactor from a transliterated port into idiomatic Go — one feature branch per step below, descriptive naming, real types, house style per ~/dev/prompts/prompts/CODE_STYLEGUIDE_GO.md.

Refactor ground rules:

  • Behavior must not change unless a step says so. The full test suite (scripted sessions, generation invariants, C-compatible RNG goldens) gates every step; 80x24 seed-compatible gameplay stays intact.
  • Renames keep the C lineage greppable: doc comments retain their "(file.c func_name)" breadcrumbs, and the docs refresh step adds a C-name → Go-name table to ARCHITECTURE.md.

Next Step

Finish adopting the house Go linting standards. Done so far (branch refactor/lint-adoption): .golangci.yml copied verbatim from the prompts repo (plus the sneak-approved paralleltest exception, 2026-07-06); ~1,500 findings fixed (autofix formatting sweep, errcheck/ err113/noinlineerr error handling, forbidigo, funcorder, recvcheck pointer receivers, goprintffuncname renames msg helpers to *f, revive doc comments, gocritic switch rewrites, gosec real fixes plus justified nolints, unparam signature tightening, C-faithful "missle" spellings restored after misspell autofix changed game text). Remaining findings are all in linters awaiting sneak's exception decision: mnd (288), gochecknoglobals (37), cyclop (36), nestif (30), gocognit (23), exhaustive (22), goconst (16), testpackage (9). Blocked on that decision; either disable with approval or scope the fixes.

Completed Steps

  • 2026-07-06 Module base path updated to git.eeqj.de/sneak/rgoue (go.mod, term/ and cmd/ imports, ARCHITECTURE.md, version string).
  • 2026-07-06 Refactor step 3 (refactor/object-fields): Object.Arm split into ArmorClass/Charges/GoldValue/Bonus (rings); Stats.Arm → ArmorClass; damage strings parsed once into DiceSpec at table definition (ParseDice keeps C roll_em parse semantics, incl. "%%%x0" and "000x0" edge cases, regression-tested); save format 5.4.4-go3.
  • 2026-07-06 Refactor step 2 (refactor/typed-kinds, b940cfc): ObjectKind separates item category from map glyph (Object.Type byte → Kind ObjectKind with Glyph()); PotionKind/ScrollKind/RingKind/ WandKind/WeaponKind/ArmorKind/TrapKind typed iota enums with Stringer; typed accessors on Object; getItem/inventory/whatis filters take ObjectKind (KindCallable/KindRingOrStick replace CALLABLE/R_OR_S); save format bumped to 5.4.4-go2. Suite green.
  • 2026-07-06 Refactor step 1 (refactor/descriptive-constants): renamed all flag bits, trap types, item subtype constants, and Max* counts to descriptive names (IsHuh→Confused, SeeMonst→SenseMonsters, WsHasteM→WandHasteMonster, MaxSticks→NumWandTypes, ...); Level.NTraps→TrapCount; C names kept as comment breadcrumbs. Pure rename, suite green.
  • 2026-07-06 Made the rgoue branch Go-only: removed C sources and the autoconf/VS build system (they remain on master and modern-rogue), ported the last wizard command (item-probability listing), rewrote README.md for the Go port (c0b533e)
  • 2026-07-06 Ported the command loop, save/restore, the tcell terminal layer, and the playable binary at cmd/rogue (41fc104)
  • 2026-07-06 Ported item effects: potions, scrolls, options, call_it (cdf9bf7)
  • 2026-07-06 Ported combat, the chase driver, traps, zapping, death and scores (3c5add8)
  • 2026-07-06 Ported dungeon generation, base items, the pack, and monster creation (a69ef7d)
  • 2026-07-06 Ported the foundation: types, seed-compatible RNG, item tables, daemon scheduler (7fa2048)
  • 2026-07-06 Wrote ARCHITECTURE.md Parts 1 and 2: complete map of the C program and the Go port design (91eeee0, 45dba95)
  • Fork base: Davidslv/rogue C 5.4.4 with modernization fixes (C23 prototypes, ncurses compat), preserved on master/modern-rogue

Future Steps

  1. Refactor step 4: method renames, movement/world subsystem (doMove→moveHero, beTrapped→springTrap, rndmove→randomStep, doRooms/doPassages/doMaze→digRooms/digPassages/digMaze, chgStr→changeStrength, ...); remove the goto/label flows in doMove, dispatch, and saveGame in favor of loops and helpers.
  2. Refactor step 5: method renames, items/combat/UI subsystems (invName→inventoryName, rollEm→rollAttacks, doPot→applyPotionFuse, getItem→promptPackItem returning (obj, ok), getDir→promptDirection); int status codes (attack returning -1) become named results. Two or three commits, one subsystem each.
  3. Refactor step 6: extract types from the god object — MessageLine owns the msg/addmsg/endmsg machinery; pack/inventory operations move onto *Player; monster/object list management and map queries consolidate onto *Level; RogueGame keeps turn orchestration and cross-system effects only.
  4. Refactor step 7: effects dispatch — the giant quaff/readScroll/doZap switches become per-kind handler tables of small named methods, keeping effect order and RNG call sequence identical.
  5. Refactor step 8: constructor and style pass per the house styleguide — game.New(game.Params{...}) replacing NewGame(Config); replace the gameEnd panic unwind with error-based turn results where feasible; 77-column wrap sweep.
  6. Docs refresh: update ARCHITECTURE.md Part 2 and README.md for the post-refactor names; add the C name → Go name rename table.
  7. Playtest hardening pass: play several full games with the tcell binary and extend run_test.go to script a deeper multi-level playthrough (descend past level 5, use potions, scrolls, zapping, save/restore). Fix any panics, message mismatches, or divergences from the C behavior that this uncovers, with regression tests.
  8. Verify the seed-compatibility claim against the C reference on c-master: same seed, same dungeon, same item tables, for several seeds.
  9. Broaden unit test coverage where playtesting finds thin spots (rings, sticks, wizard commands).
  10. Tag a release once a full game (Amulet retrieval and score entry) completes without defects.
  11. Full-terminal-size support (deferred by explicit decision 2026-07-06): per-game dungeon dimensions instead of the 80x24 constants; open design questions are resize policy, gameplay tuning at larger sizes, and a --classic 80x24 mode.
  12. Note: this repo is exempt from the standard policy scaffold. Do not add Makefile, Dockerfile, or REPO_POLICIES.md.