What problem does it solve?
This Skill helps you avoid fragile nil checks and repetitive error-handling by using samber/mo monadic types so your Go code becomes safer and easier to compose.
Core Features & Use Cases
- Option[T] for absence without nil: represent nullable values (including pointer and DB nullable fields) without risking nil pointer panics.
- Result[T] for error-as-a-value: model success/failure and chain computations without manual if err != nil at every step.
- Either[L, R] for two valid alternatives: return cached-vs-fresh (or other non-error alternatives) in a type-safe way.
- Do notation for imperative style: use mo.Do to write straight-line code with MustGet while safely converting panics into Result errors.
- Pipeline sub-packages for type-changing transforms: use option/result/either sub-packages and PipeN/PipeN functions when chaining requires changing types across steps.
Quick Start
Use the golang-samber-mo skill when you are designing Go domain logic with nullable inputs, composable transformations, and error propagation using samber/mo Option, Result, or Either.