golang-samber-mo

Implement Option, Result, and Either monads for safe Go data transformations.

5|1|Updated Apr 14, 2026
One-click install
npx skills add https://github.com/omarluq/og-template --skill golang-samber-mo-omarluq
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-samber-mo
Source: https://github.com/omarluq/og-template/tree/main/.agents/skills/golang-samber-mo
Command: npx skills add https://github.com/omarluq/og-template --skill golang-samber-mo-omarluq

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Go lacks built-in monadic patterns for nil safety and error handling; this skill provides Option, Result, and Either with pipelines to make those concerns explicit in Go code.

Core Features & Use Cases

  • Type-safe nullable values with Option for JSON/DB models
  • Composable error handling with Result and Do notation
  • Discriminated unions with Either and multi-variant Either3/Either4
  • Pipelines and sub-packages for type-changing maps and cross-type transformations

Quick Start

Create a small Go module that imports github.com/samber/mo and demonstrates Option, Result, and Either in a simple end-to-end pipeline.

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 JSON or database fields safely in Go?

Using the Option monad handles nullable JSON or database fields safely in Go by providing a type-safe wrapper for values that may or may not exist, replacing nil checks with explicit present or absent states in your data models.

What is the best way to chain error handling across multiple steps in Go?

The best way to chain error handling across multiple steps in Go is using the Result monad with Do notation, enabling rail-roaded data transformations that short-circuit pipelines on failure and propagate errors automatically across components.

How do I represent discriminated unions with multiple variants in Go?

Representing discriminated unions with multiple variants in Go is done using the Either monad alongside multi-variant Either3 and Either4 types, allowing pipelines to safely branch and transform values across distinct type paths.

Can I use Go generics to build composable functional pipelines?

You can use Go generics to build composable functional pipelines because the API surface is fully generics-based, offering type-changing maps and cross-type transformation helpers across sub-packages for robust data flows.

Do I need external dependencies to use monadic patterns in Go?

No external dependencies are required to use monadic patterns in Go, as the Skill provides self-contained Option, Result, and Either abstractions with pipeline helpers that satisfy a Go-generics based API surface directly.

When should I not use monads for error handling in Go pipelines?

Avoid using monads for error handling in Go pipelines when a simple if-err check suffices, as introducing Option, Result, or Either abstractions in trivial flows may add unnecessary structural complexity without functional benefit.