Loading...
Loading...
Idiomatic Golang error handling — creation, wrapping with %w, errors.Is/As, errors.Join, custom error types, sentinel errors, panic/recover, the single handling rule, structured logging with slog, HTTP request logging middleware, and samber/oops for production errors. Built to make logs usable at scale with log aggregation 3rd-party tools. Apply when creating, wrapping, inspecting, or logging errors in Go code.
npx skill4agent add samber/cc-skills-golang golang-error-handlingCommunity default. A company skill that explicitly supersedesskill takes precedence.samber/cc-skills-golang@golang-error-handling
_fmt.Errorf("{context}: %w", err)%w%verrors.Iserrors.Aserrors.Joinpanicslogfmt.Printlnlog.Printfsamber/oopsslogsamber/oops.With()fmt.Errorf("{context}: %w", err)fmt.Errorf("{context}: %v", err)errors.Iserrors.Aserrors.Joinsamber/oopsslogerrors.Newfmt.Errorf%w%verrors.Iserrors.As_panicslogsamber/cc-skills-golang@golang-samber-oopssamber/cc-skills-golang@golang-observabilitysamber/cc-skills-golang@golang-safetysamber/cc-skills-golang@golang-naming