UNPKG

pi-lens

Version:

Real-time code feedback for pi — LSP, linters, formatters, type-checking, structural analysis & booboo

46 lines (36 loc) • 871 B
# Go Reliability # Detects direct panic calls in application/library code. id: go-direct-panic name: Direct panic() Call severity: warning category: reliability defect_class: safety inline_tier: blocking language: go message: "Direct panic() call can crash the process — return or propagate an error instead" description: | Calling `panic(...)` for ordinary error paths can terminate the process and bypass normal recovery/cleanup flow. ✅ FIX: return an error, wrap it, or handle it at the boundary layer. query: | (call_expression function: (identifier) @FN arguments: (argument_list) @ARGS (#eq? @FN "panic")) metavars: - FN - ARGS has_fix: false tags: - go - reliability - safety examples: bad: | if err != nil { panic(err) } good: | if err != nil { return fmt.Errorf("failed: %w", err) }