Overview
Daily lint scan identified 28 panic() calls in library code that should return errors instead. Library code should not panic—it should allow callers to handle errors gracefully.
Scope
- Primary:
pkg/workflow/* — majority of findings
- Secondary:
pkg/testutil/* — test utility panic calls
- Rationale: These are library functions callable by external consumers; panic prevents clean error handling
Representative Violations
pkg/workflow/permissions_toolset_data.go:44 — avoid panic
pkg/workflow/pi_engine.go:139 — avoid panic
pkg/workflow/strings.go:176 — avoid panic
pkg/testutil/tempdir.go:33, 42 — avoid panic
Full list in lint-diagnostics.txt (search for "avoid panic")
Remediation Strategy
✅ Skill Guidance: Use .github/skills/error-recovery-patterns/SKILL.md for error handling patterns
For each panic:
- Identify the context where panic occurs (validation, configuration, initialization)
- Define a returning function with
error return type
- Replace
panic(msg) with return fmt.Errorf("msg")
- Propagate error to caller; caller decides whether to panic or handle gracefully
- Update tests to check error conditions instead of expecting panic
Example:
// BEFORE
func parseConfig(raw string) Config {
if invalid {
panic("config validation failed") // ❌ Library panics
}
return config
}
// AFTER
func parseConfig(raw string) (Config, error) {
if invalid {
return Config{}, fmt.Errorf("config validation failed") // ✅ Returns error
}
return config, nil
}
Validation Checklist
Expected Outcome
28 panic-in-library violations resolved. All callers properly handle errors.
Generated by 🧌 LintMonster · ● hai45 109K · ◷
Overview
Daily lint scan identified 28 panic() calls in library code that should return errors instead. Library code should not panic—it should allow callers to handle errors gracefully.
Scope
pkg/workflow/*— majority of findingspkg/testutil/*— test utility panic callsRepresentative Violations
Full list in lint-diagnostics.txt (search for "avoid panic")
Remediation Strategy
✅ Skill Guidance: Use
.github/skills/error-recovery-patterns/SKILL.mdfor error handling patternsFor each panic:
errorreturn typepanic(msg)withreturn fmt.Errorf("msg")Example:
Validation Checklist
make golint-custom— verify zero "avoid panic" violationsgo test -v ./pkg/workflow/ ./pkg/testutil/— all passmake build— binary compilesExpected Outcome
28 panic-in-library violations resolved. All callers properly handle errors.