Skip to main content

go-errors

Use this skill when writing, reviewing, or debugging Go error handling — wrapping errors, sentinel errors, error type checking, panicking, or handling errors in defer.

Quellinformationen

Repository
xrplf/xrpl-go
Letzte Quellaktivität
8. Mai 2026 um 14:17
Erkannte Sprache von SKILL.md
Englisch
Sterne
23
Forks
25

Installationsoptionen

Standardmäßig ist der Prompt ausgewählt, der zuerst die Quelle prüft. Sie können zu einem direkten Befehl wechseln oder eine lokale Kopie herunterladen.

Quelldateien prüfen

Lesen Sie SKILL.md und alle von SkillsMP angezeigten Begleitdateien, bevor Sie sich für eine Installation entscheiden.

Datei-Explorer
11 Dateien

SKILL.md wird angezeigt

SKILL.md
Quellanweisungen · Schreibgeschützte Vorschau
name
go-errors
description
Use this skill when writing, reviewing, or debugging Go error handling — wrapping errors, sentinel errors, error type checking, panicking, or handling errors in defer.
# Go Error Management Critical patterns for robust Go error handling. Covers sentinel errors, error wrapping with context, type/value checking, defer error patterns, and when to use panic vs return. ## When to Use This Skill - Writing error handling for any Go function - Reviewing code for ignored or swallowed errors - Using `errors.Is` / `errors.As` correctly - Deciding whether to wrap or not wrap an error - Handling errors inside defer statements ## How It Works 1. Identifies error handling anti-patterns (CRITICAL impact) 2. Explains the production consequences of each mistake 3. Shows correct error propagation and wrapping patterns 4. Covers the full error handling lifecycle ## Categories Covered 1. **Error Management** — sentinel values, wrapping, type checking, panicking, defer errors, ignored returns ## Present Results to User When identifying issues: ``` ❌ Found: Ignoring error return value 📍 Location: handlers/user.go:45 ⚠️ Impact: CRITICAL - Silent failures in production ✅ Fix: Check and handle the error explicitly [Show incorrect code] [Show correct code] [Explain why the fix matters] ``` ## Troubleshooting **When is it safe to ignore errors:** - `Close()` in defer after a successful write is sometimes acceptable — but log it - Use explicit `_ = f.Close()` to show the ignore is intentional, never silent **errors.Is vs errors.As:** - `errors.Is` checks for a specific error value (sentinel) - `errors.As` checks for a specific error type and unwraps the chain
Auf GitHub ansehen