golang-samber-mo

Implement type-safe Option, Result, and Either pipelines in Go.

Updated May 28, 2026
One-click install
npx skills add https://github.com/vanstinator/semantic-search --skill golang-samber-mo-vanstinator
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-samber-mo
Source: https://github.com/vanstinator/semantic-search/tree/main/.agents/skills/golang-samber-mo
Command: npx skills add https://github.com/vanstinator/semantic-search --skill golang-samber-mo-vanstinator

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps Go developers replace fragile nil checks and repetitive error handling with type-safe monadic pipelines that make invalid states harder to represent.

Core Features & Use Cases

  • Option[T] for nullable values: Use Option to model presence vs absence without nil pointer panics, including safe extraction and transformation.
  • Result[T] for fallible operations: Use Result to model success vs error and chain operations with automatic short-circuiting.
  • Either[L, R] for two valid alternatives: Use Either when neither side is an error, such as cached vs fresh data paths, and handle both cases with Match.
  • Type-changing pipelines via sub-packages: Apply option/result/either sub-packages when transformations must change types, and use PipeN for readable multi-step flows.

Quick Start

In your Go codebase, use the instruction “Show me how to convert a (value, ok) tuple and chain it into an Option pipeline using samber/mo for safe nullable handling.”

Frequently Asked Questions about golang-samber-mo

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

FAQPage Schema
How do I handle nullable values in Go without nil pointer panics?

Use Option[T] to model nullable values in Go, wrapping presence or absence safely to eliminate nil pointer panics. You can extract and transform values through safe constructors without risking runtime crashes.

What is the best way to chain fallible operations and simplify error handling in Go?

Use Result[T] to model fallible operations in Go, chaining them into functional pipelines that short-circuit automatically on errors. This replaces repetitive if-err checks with composable, type-safe transformations.

When should I use Either instead of Result for Go error handling?

Use Either[L, R] in Go when both sides are valid alternatives rather than success versus error, such as choosing between cached and fresh data paths. Result[T] is specifically for fallible computations that return errors.

Do I need Go 1.18+ generics to use monadic pipelines for type-safe error handling?

Yes, Go 1.18+ generics are required because monadic abstractions like Option, Result, and Either rely on generic type parameters to enforce type safety across functional pipelines and nullable fields.

How do I change types within an Option or Result pipeline in Go?

Use the option, result, and either sub-packages to apply type-changing transformations within a Go pipeline. PipeN functions enable readable, multi-step flows that safely convert types across successive operations.

Can I control side effects and async execution explicitly in Go functional pipelines?

Yes, these monadic abstractions provide explicit control over side effects and async execution within Go functional pipelines. You model alternative flows and fallible computations safely without hidden state changes.