fix: Address golangci-lint errors (errcheck, gosec) (#76)

Apply PR #76 from dannomayernotabot:

- Add golangci exclusions for internal package false positives
- Tighten file permissions (0644 -> 0600) for sensitive files
- Add ReadHeaderTimeout to HTTP server (slowloris prevention)
- Explicit error ignoring with _ = for intentional cases
- Add //nolint comments with justifications
- Spelling: cancelled -> canceled (US locale)

Co-Authored-By: dannomayernotabot <noreply@github.com>

🤖 Generated with Claude Code
This commit is contained in:
max
2026-01-03 16:11:40 -08:00
committed by Steve Yegge
parent 62848065e3
commit 1b69576573
82 changed files with 325 additions and 355 deletions

View File

@@ -179,14 +179,8 @@ func runStart(cmd *cobra.Command, args []string) error {
// startCoreAgents starts Mayor and Deacon sessions.
func startCoreAgents(t *tmux.Tmux) error {
// Get session names
mayorSession, err := getMayorSessionName()
if err != nil {
return fmt.Errorf("getting Mayor session name: %w", err)
}
deaconSession, err := getDeaconSessionName()
if err != nil {
return fmt.Errorf("getting Deacon session name: %w", err)
}
mayorSession := getMayorSessionName()
deaconSession := getDeaconSessionName()
// Start Mayor first (so Deacon sees it as up)
mayorRunning, _ := t.HasSession(mayorSession)
@@ -335,15 +329,15 @@ func ensureRefinerySession(rigName string, r *rig.Rig) (bool, error) {
// Set environment
bdActor := fmt.Sprintf("%s/refinery", rigName)
t.SetEnvironment(sessionName, "GT_ROLE", "refinery")
t.SetEnvironment(sessionName, "GT_RIG", rigName)
t.SetEnvironment(sessionName, "BD_ACTOR", bdActor)
_ = t.SetEnvironment(sessionName, "GT_ROLE", "refinery")
_ = t.SetEnvironment(sessionName, "GT_RIG", rigName)
_ = t.SetEnvironment(sessionName, "BD_ACTOR", bdActor)
// Set beads environment
beadsDir := filepath.Join(r.Path, "mayor", "rig", ".beads")
t.SetEnvironment(sessionName, "BEADS_DIR", beadsDir)
t.SetEnvironment(sessionName, "BEADS_NO_DAEMON", "1")
t.SetEnvironment(sessionName, "BEADS_AGENT_NAME", fmt.Sprintf("%s/refinery", rigName))
_ = t.SetEnvironment(sessionName, "BEADS_DIR", beadsDir)
_ = t.SetEnvironment(sessionName, "BEADS_NO_DAEMON", "1")
_ = t.SetEnvironment(sessionName, "BEADS_AGENT_NAME", fmt.Sprintf("%s/refinery", rigName))
// Apply Gas Town theming (non-fatal: theming failure doesn't affect operation)
theme := tmux.AssignTheme(rigName)
@@ -391,8 +385,8 @@ func runShutdown(cmd *cobra.Command, args []string) error {
}
// Get session names for categorization
mayorSession, _ := getMayorSessionName()
deaconSession, _ := getDeaconSessionName()
mayorSession := getMayorSessionName()
deaconSession := getDeaconSessionName()
toStop, preserved := categorizeSessions(sessions, mayorSession, deaconSession)
if len(toStop) == 0 {
@@ -421,7 +415,7 @@ func runShutdown(cmd *cobra.Command, args []string) error {
response, _ := reader.ReadString('\n')
response = strings.TrimSpace(strings.ToLower(response))
if response != "y" && response != "yes" {
fmt.Println("Shutdown cancelled.")
fmt.Println("Shutdown canceled.")
return nil
}
}
@@ -515,8 +509,8 @@ func runGracefulShutdown(t *tmux.Tmux, gtSessions []string, townRoot string) err
// Phase 4: Kill sessions in correct order
fmt.Printf("\nPhase 4: Terminating sessions...\n")
mayorSession, _ := getMayorSessionName()
deaconSession, _ := getDeaconSessionName()
mayorSession := getMayorSessionName()
deaconSession := getDeaconSessionName()
stopped := killSessionsInOrder(t, gtSessions, mayorSession, deaconSession)
// Phase 5: Cleanup polecat worktrees and branches
@@ -533,8 +527,8 @@ func runGracefulShutdown(t *tmux.Tmux, gtSessions []string, townRoot string) err
func runImmediateShutdown(t *tmux.Tmux, gtSessions []string, townRoot string) error {
fmt.Println("Shutting down Gas Town...")
mayorSession, _ := getMayorSessionName()
deaconSession, _ := getDeaconSessionName()
mayorSession := getMayorSessionName()
deaconSession := getDeaconSessionName()
stopped := killSessionsInOrder(t, gtSessions, mayorSession, deaconSession)
// Cleanup polecat worktrees and branches