gofmt: bring internal/ and cmd/ back to gofmt -l clean

Mechanical `gofmt -w ./internal ./cmd`. Mostly struct-field realignment that
had drifted, plus a few trailing-newline fixes. No behaviour change — gofmt is
semantics-preserving, and build/vet/test are green either side.

Split out from the code-review fixes that follow so those stay reviewable
instead of hiding inside a wall of realignment.
This commit is contained in:
prosolis
2026-07-10 07:18:07 -07:00
parent 08d3053368
commit 3369d7d8fe
108 changed files with 1248 additions and 1260 deletions

View File

@@ -3,15 +3,18 @@
// outcomes mirror what live players hit.
//
// Single run:
//
// expedition-sim [-class fighter] [-level 5] [-zone goblin_warrens]
// [-bank 1000] [-cap 50] [-log] [-data DIR]
//
// Party run (N3/P7 — the leader is -class; followers clone it unless named):
//
// expedition-sim -party 3 -level 15 -zone dragons_lair
// expedition-sim -party 2 -class cleric -party-classes fighter -level 16 ...
//
// Matrix mode (cartesian sweep over classes × levels × zones × N runs,
// one JSON object per stdout line, log suppressed by default):
//
// expedition-sim -matrix -classes fighter,mage -levels 5,10 \
// -zones goblin_warrens,wolf_den -runs 20
package main
@@ -269,7 +272,6 @@ func matrixWorker(exe string, in <-chan matrixJob, out chan<- *plugin.SimResult,
}
}
func runOne(dataDir string, uid id.UserID, class plugin.DnDClass, level int, zone plugin.ZoneID, bank float64, cap, days int, followers []string) (*plugin.SimResult, error) {
runner, err := plugin.NewSimRunner(dataDir)
if err != nil {

View File

@@ -1558,4 +1558,3 @@ func (p *AdventurePlugin) handleBoostCmd(ctx MessageContext) error {
advSetBoost(true)
return p.SendReply(ctx.RoomID, ctx.EventID, "⚡ Double XP/money boost **enabled**! All adventure XP and loot values are doubled.")
}

View File

@@ -79,4 +79,3 @@ var blacksmithBrokenCondition = []string{
"_looks at the condition, looks at you, looks back at the condition_ You know it costs more when you let it get like this. Of course you know. You just didn't care. That's fine. I care enough for both of us. It'll cost you.",
"This could have been avoided with regular visits. _slides the cost estimate across the counter without breaking eye contact_",
}

View File

@@ -275,6 +275,7 @@ var PetCatDeflect = []string{
"Your cat is already somewhere else.\n\nIt blinks.\n\nNot at you.\n\nAt nothing.\n\n" +
"The way cats do.",
}
// Fires randomly in the morning DM. Cat has left something.
// Results in a defense boost for the day.
// The cat is proud. The cat will never stop doing this.

View File

@@ -920,7 +920,6 @@ func renderAdvDailySummary(date string, tb *TwinBeeResult, tbRewards TwinBeeRewa
sb.WriteString("\n")
}
// Standout
if bestPlayer != nil && bestPlayer.LootValue > 0 {
pool := SummaryStandoutGood

View File

@@ -877,5 +877,3 @@ func (p *BlackjackPlugin) recordBJScore(userID id.UserID, net float64) {
recordBotDefeat(userID, "blackjack")
}
}

View File

@@ -592,4 +592,3 @@ func (p *AdventurePlugin) resolveDungeonAction(
return result
}

View File

@@ -1298,4 +1298,3 @@ func trySave(st *combatState, player *Combatant, phaseName string) bool {
}
return false
}

View File

@@ -137,6 +137,7 @@ const (
)
// ArmorProfile is the spec's struct. MaxDEXBonus convention:
//
// -1 = unlimited (light armor takes full DEX mod)
// 2 = medium (cap at +2)
// 0 = heavy (no DEX bonus)

View File

@@ -535,4 +535,3 @@ func nullableString(s string) any {
}
return s
}

View File

@@ -96,7 +96,6 @@ func TestSaveHarvestNodes_DropsLegacyRoomKey(t *testing.T) {
}
}
func TestResolveHarvestOutcome_Brackets(t *testing.T) {
cases := []struct {
roll, dc int

View File

@@ -323,6 +323,7 @@ func addSupplyPurchase(s ExpeditionSupplies, p SupplyPurchase) ExpeditionSupplie
// - siege overrides everything with a hard 2× floor (even for tier 1
// where HarshMod is 1×) — the dungeon is actively starving you out.
// - otherwise, harshActive applies HarshMod (zone-tier scaled).
//
// phase5BDailyBurnRatePct is the shipped daily-burn multiplier from
// Phase 3-B's sweep + Phase 5-B's post-buff re-validation. 50 means
// "half live burn" — needed because the Phase 5-B player power floor

View File

@@ -455,6 +455,7 @@ const AbyssInstabilityPerDay = 5
const AbyssMaxInstability = 100
// AbyssInstabilityBandFor classifies the §7.6 instability tiers.
//
// normal: 020
// mild: 2140 (-1 WIS)
// warp: 4160 (rooms shift order)

View File

@@ -102,6 +102,7 @@ func applyRacePassives(stats *CombatStats, mods *CombatModifiers, c *DnDCharacte
// BEFORE consumable application (so consumables can stack on top).
//
// Some passives ride on existing CombatModifiers fields:
//
// Rogue's Sneak Attack reuses AutoCritFirst (the consumable Crystal Berry
// field) — the engine already implements first-hit-auto-crit semantics.
// Cleric's Divine Favor reuses HealItem, the under-50%-HP heal trigger.

View File

@@ -105,13 +105,13 @@ func (p *AdventurePlugin) handleDnDSetupCmd(ctx MessageContext, args string) err
case lower == "cancel":
return p.dndSetupCancel(ctx)
}
return p.SendDM(ctx.Sender,"Unknown !setup subcommand. Try !setup with no args for instructions.")
return p.SendDM(ctx.Sender, "Unknown !setup subcommand. Try !setup with no args for instructions.")
}
func (p *AdventurePlugin) dndSetupStatus(ctx MessageContext) error {
c, err := LoadDnDCharacter(ctx.Sender)
if err != nil {
return p.SendDM(ctx.Sender,"Couldn't load your Adv 2.0 draft: "+err.Error())
return p.SendDM(ctx.Sender, "Couldn't load your Adv 2.0 draft: "+err.Error())
}
// No row yet → fresh setup. Show suggestion + race menu.
@@ -125,7 +125,7 @@ func (p *AdventurePlugin) dndSetupStatus(ctx MessageContext) error {
b.WriteString("**Step 1 — Race.** Pick one of:\n")
b.WriteString(renderRaceMenu())
b.WriteString("\nReply: `!setup race <name>` (e.g. `!setup race elf`)\n")
return p.SendDM(ctx.Sender,b.String())
return p.SendDM(ctx.Sender, b.String())
}
// Confirmed already → reroute to !sheet, unless this is an auto-migrated
@@ -152,62 +152,62 @@ func (p *AdventurePlugin) dndSetupStatus(ctx MessageContext) error {
b.WriteString("**Next: Step 1 — Race.**\n")
b.WriteString(renderRaceMenu())
b.WriteString("\nReply: `!setup race <name>`\n")
return p.SendDM(ctx.Sender,b.String())
return p.SendDM(ctx.Sender, b.String())
}
b.WriteString(fmt.Sprintf("Race: **%s** ✓\n", titleRace(c.Race)))
if c.Class == "" {
b.WriteString("\n**Next: Step 2 — Class.**\n")
b.WriteString(renderClassMenu())
b.WriteString("\nReply: `!setup class <name>`\n")
return p.SendDM(ctx.Sender,b.String())
return p.SendDM(ctx.Sender, b.String())
}
b.WriteString(fmt.Sprintf("Class: **%s** ✓\n", titleClass(c.Class)))
if !statsAssigned(c) {
b.WriteString("\n**Next: Step 3 — Ability Scores.**\n")
b.WriteString("Assign these six values — **15 14 13 12 10 8** — to STR, DEX, CON, INT, WIS, CHA. Each value used exactly once.\n\n")
b.WriteString("Reply: `!setup stats 15 14 13 12 10 8` (rearrange to taste).\n")
return p.SendDM(ctx.Sender,b.String())
return p.SendDM(ctx.Sender, b.String())
}
b.WriteString(fmt.Sprintf("Stats (pre-racial): STR %d DEX %d CON %d INT %d WIS %d CHA %d ✓\n",
c.STR, c.DEX, c.CON, c.INT, c.WIS, c.CHA))
b.WriteString("\n**Step 4 — Confirm.** Reply `!setup confirm` to finalize, or `!setup cancel` to scrap and start over.\n")
b.WriteString(renderConfirmPreview(c))
return p.SendDM(ctx.Sender,b.String())
return p.SendDM(ctx.Sender, b.String())
}
func (p *AdventurePlugin) dndSetupRace(ctx MessageContext, raceArg string) error {
r, ok := parseRace(raceArg)
if !ok {
return p.SendDM(ctx.Sender,"Unknown race. Options: human, elf, dwarf, halfling, orc, tiefling, half-elf")
return p.SendDM(ctx.Sender, "Unknown race. Options: human, elf, dwarf, halfling, orc, tiefling, half-elf")
}
c, err := loadOrInitDraft(ctx.Sender)
if err != nil {
return p.SendDM(ctx.Sender,"Couldn't open your draft: "+err.Error())
return p.SendDM(ctx.Sender, "Couldn't open your draft: "+err.Error())
}
c.Race = r
if err := SaveDnDCharacter(c); err != nil {
return p.SendDM(ctx.Sender,"Couldn't save: "+err.Error())
return p.SendDM(ctx.Sender, "Couldn't save: "+err.Error())
}
ri, _ := raceInfo(r)
return p.SendDM(ctx.Sender,fmt.Sprintf("Race set: **%s**. _%s_\n\nNext: `!setup class <name>` — see options with `!setup`.",
return p.SendDM(ctx.Sender, fmt.Sprintf("Race set: **%s**. _%s_\n\nNext: `!setup class <name>` — see options with `!setup`.",
ri.Display, ri.Passive))
}
func (p *AdventurePlugin) dndSetupClass(ctx MessageContext, classArg string) error {
cl, ok := parseClass(classArg)
if !ok {
return p.SendDM(ctx.Sender,"Unknown class. Options: fighter, rogue, mage, cleric, ranger")
return p.SendDM(ctx.Sender, "Unknown class. Options: fighter, rogue, mage, cleric, ranger")
}
c, err := loadOrInitDraft(ctx.Sender)
if err != nil {
return p.SendDM(ctx.Sender,"Couldn't open your draft: "+err.Error())
return p.SendDM(ctx.Sender, "Couldn't open your draft: "+err.Error())
}
c.Class = cl
if err := SaveDnDCharacter(c); err != nil {
return p.SendDM(ctx.Sender,"Couldn't save: "+err.Error())
return p.SendDM(ctx.Sender, "Couldn't save: "+err.Error())
}
ci, _ := classInfo(cl)
return p.SendDM(ctx.Sender,fmt.Sprintf("Class set: **%s** — leans on %s & %s.\n\n"+
return p.SendDM(ctx.Sender, fmt.Sprintf("Class set: **%s** — leans on %s & %s.\n\n"+
"Next: assign your stats. The standard array is **15 14 13 12 10 8** — six numbers, each used once.\n"+
"Order: STR DEX CON INT WIS CHA.\n\n"+
"Example: `!setup stats 15 14 13 12 10 8` (all rolled into STR-first; rearrange to taste).",
@@ -227,29 +227,29 @@ func (p *AdventurePlugin) dndSetupStats(ctx MessageContext, statsArg string) err
}
c, err := loadOrInitDraft(ctx.Sender)
if err != nil {
return p.SendDM(ctx.Sender,"Couldn't open your draft: "+err.Error())
return p.SendDM(ctx.Sender, "Couldn't open your draft: "+err.Error())
}
c.STR, c.DEX, c.CON, c.INT, c.WIS, c.CHA = scores[0], scores[1], scores[2], scores[3], scores[4], scores[5]
if err := SaveDnDCharacter(c); err != nil {
return p.SendDM(ctx.Sender,"Couldn't save: "+err.Error())
return p.SendDM(ctx.Sender, "Couldn't save: "+err.Error())
}
var b strings.Builder
b.WriteString("Stats saved (pre-racial bonuses).\n")
b.WriteString(renderConfirmPreview(c))
b.WriteString("\nReply `!setup confirm` to finalize.")
return p.SendDM(ctx.Sender,b.String())
return p.SendDM(ctx.Sender, b.String())
}
func (p *AdventurePlugin) dndSetupConfirm(ctx MessageContext) error {
c, err := LoadDnDCharacter(ctx.Sender)
if err != nil || c == nil {
return p.SendDM(ctx.Sender,"No setup draft found. Run `!setup` to start.")
return p.SendDM(ctx.Sender, "No setup draft found. Run `!setup` to start.")
}
if !c.PendingSetup {
return p.SendDM(ctx.Sender,"Already confirmed. Use `!sheet` to view your character.")
return p.SendDM(ctx.Sender, "Already confirmed. Use `!sheet` to view your character.")
}
if c.Race == "" || c.Class == "" || !statsAssigned(c) {
return p.SendDM(ctx.Sender,"Draft incomplete. Run `!setup` to see what's missing.")
return p.SendDM(ctx.Sender, "Draft incomplete. Run `!setup` to see what's missing.")
}
// Apply racial modifiers to the assigned scores.
@@ -283,28 +283,28 @@ func (p *AdventurePlugin) dndSetupConfirm(ctx MessageContext) error {
c.UpdatedAt = time.Now().UTC()
if err := SaveDnDCharacter(c); err != nil {
return p.SendDM(ctx.Sender,"Couldn't save: "+err.Error())
return p.SendDM(ctx.Sender, "Couldn't save: "+err.Error())
}
_ = initResources(ctx.Sender, c.Class)
// Phase 9: caster classes get a default known-spell list and slot pool.
// Idempotent — !setup confirm after a respec wipe will repopulate.
_ = ensureSpellsForCharacter(c)
return p.SendDM(ctx.Sender,renderSetupComplete(c))
return p.SendDM(ctx.Sender, renderSetupComplete(c))
}
func (p *AdventurePlugin) dndSetupCancel(ctx MessageContext) error {
c, err := LoadDnDCharacter(ctx.Sender)
if err != nil || c == nil {
return p.SendDM(ctx.Sender,"No draft to cancel.")
return p.SendDM(ctx.Sender, "No draft to cancel.")
}
if !c.PendingSetup {
return p.SendDM(ctx.Sender,"Your character is already finalized — use `!respec` instead.")
return p.SendDM(ctx.Sender, "Your character is already finalized — use `!respec` instead.")
}
if _, err := dbExecCancel(ctx.Sender); err != nil {
return p.SendDM(ctx.Sender,"Couldn't cancel: "+err.Error())
return p.SendDM(ctx.Sender, "Couldn't cancel: "+err.Error())
}
return p.SendDM(ctx.Sender,"Draft scrapped. Run `!setup` to start over.")
return p.SendDM(ctx.Sender, "Draft scrapped. Run `!setup` to start over.")
}
// ── !respec ──────────────────────────────────────────────────────────────────

View File

@@ -623,4 +623,3 @@ func addLoot(runID string, itemID string) error {
WHERE run_id = ?`, string(lootJSON), runID)
return err
}

View File

@@ -583,4 +583,3 @@ func (p *EuroPlugin) handleGrant(ctx MessageContext) error {
return p.SendReply(ctx.RoomID, ctx.EventID,
fmt.Sprintf("✅ Granted €%d to **%s**. New balance: €%d.", int(amount), targetName, int(newBalance)))
}

View File

@@ -1281,6 +1281,7 @@ func TestExpeditionBalance_Phase5A_TierWideSensitivity(t *testing.T) {
// what flat delta on top of the ladder lands T1-T5 in band.
//
// Bands (gogobee_expedition_difficulty.md):
//
// T1 80% (70-90%) T2 72% (62-82%) T3 65% (55-75%)
// T4 55% (45-65%) T5 45% (35-55%)
//

View File

@@ -171,8 +171,6 @@ func recordBotDefeat(userID id.UserID, game string) {
)
}
// redirectToGamesRoom returns the room ID for games-restricted redirect.
func redirectToGamesRoom(sender id.UserID) string {
_ = sender

View File

@@ -973,4 +973,3 @@ func (p *HangmanPlugin) recordHangmanScore(userID id.UserID, earned float64) {
string(userID), earned, earned,
)
}

View File

@@ -8,7 +8,10 @@ import (
// ── formatNumber (xp.go) ───────────────────────────────────────────────────
func TestFormatNumber_Small(t *testing.T) {
cases := []struct{ in int; want string }{
cases := []struct {
in int
want string
}{
{0, "0"},
{1, "1"},
{999, "999"},
@@ -21,7 +24,10 @@ func TestFormatNumber_Small(t *testing.T) {
}
func TestFormatNumber_WithCommas(t *testing.T) {
cases := []struct{ in int; want string }{
cases := []struct {
in int
want string
}{
{1000, "1,000"},
{10000, "10,000"},
{1000000, "1,000,000"},

View File

@@ -1249,7 +1249,6 @@ func (p *HoldemPlugin) removePlayer(game *HoldemGame, uid id.UserID) {
}
}
func (p *HoldemPlugin) getNPCBalance() int64 {
d := db.Get()
var balance int64

View File

@@ -381,4 +381,3 @@ func (g *HoldemGame) returnUncalledBet() (name string, amount int64) {
return "", 0
}

View File

@@ -2039,5 +2039,3 @@ func (p *UnoPlugin) recordGame(game *unoGame, result string, potBefore float64)
time.Now().UTC().Format("2006-01-02 15:04:05"),
)
}

View File

@@ -658,4 +658,3 @@ func parseNoMercyFlags(args string) (noMercy bool, sevenZeroRule bool, amountStr
return true, false, rest
}

View File

@@ -484,8 +484,6 @@ func wordleCategoryHint(category WordleCategory) string {
return ""
}
// isValidWord checks if a word is valid, using the in-memory cache first,
// then the custom allow-list, then DreamDict.
// Returns (valid, apiError). apiError is true when the service is unreachable.
@@ -545,7 +543,6 @@ func (p *WordlePlugin) fetchDefinition(answer string) string {
return dictFetchDefinitionText(p.dict, answer, lang)
}
func (p *WordlePlugin) nextPuzzleNumber() int {
d := db.Get()
var count int
@@ -842,4 +839,3 @@ func (p *WordlePlugin) rehydratePuzzles() {
slog.Info("wordle: rehydrated puzzle", "room", roomID, "answer_len", pr.wordLength, "guesses", len(puzzle.Guesses))
}
}

View File

@@ -120,4 +120,3 @@ func TestCurrentRoomType_GraphAuthored(t *testing.T) {
t.Errorf("graph mode + secret node: got %s, want %s", got, RoomExploration)
}
}

View File

@@ -427,4 +427,3 @@ func resolveForkChoice(pf *pendingFork, choice int) (pendingChoice, error) {
}
return c, nil
}

View File

@@ -240,4 +240,3 @@ func TestNodeKindToRoomType(t *testing.T) {
}
}
}