golang-samber-oops

Handle Golang errors with structured context, stack traces, and error codes.

Updated Jun 27, 2026
One-click install
npx skills add https://github.com/LuigiAPCPereira/evolutiondocs --skill golang-samber-oops-luigiapcpereira
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-samber-oops
Source: https://github.com/LuigiAPCPereira/evolutiondocs/tree/main/.agents/skills/golang-samber-oops
Command: npx skills add https://github.com/LuigiAPCPereira/evolutiondocs --skill golang-samber-oops-luigiapcpereira

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill unit offers a comprehensive approach to structured error handling in Golang, using the samber/oops library. It enhances the standard error handling, providing context, stack traces, error codes, and public messages.

Core Features & Use Cases

  • Structured Context: Attach key-value attributes to errors for better debugging.
  • Stack Traces: Automatically capture the call stack of an error.
  • Error Codes: Assign machine-readable identifiers to errors.
  • Public Messages: Separate technical details from user-friendly messages.
  • Panic Recovery: Convert panics into structured errors with context.

Quick Start

Execute the following command to handle errors in a Golang function: func handleError(err error) { oops.Recover(func() { panic("unhandled error") }) }

Frequently Asked Questions about golang-samber-oops

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add structured context to Golang errors?

You can add structured context to Golang errors by attaching key-value attributes using the samber/oops library. This enhances standard error handling by providing contextual details for better debugging.

What is the best way to capture stack traces in Go applications?

The best way to capture stack traces in Go applications is using the samber/oops library. It automatically captures the call stack of an error, providing deeper tracing for debugging.

Can I separate technical error details from user-friendly messages in Golang?

You can separate technical error details from user-friendly messages in Golang using samber/oops. It provides public messages to isolate internal stack traces from end-user communication.

How do I recover from panics and convert them into structured errors?

You can recover from panics and convert them into structured errors using the panic recovery feature in samber/oops. Execute `oops.Recover` with a closure to capture context.

Does this structured error handling approach require external dependencies?

This structured error handling approach requires the samber/oops library within your Go codebase. It is designed for projects involving Go-based applications to enhance error structure.