go-functional-options

Installation
SKILL.md

Functional Options Pattern

Functional options is a pattern where you declare an opaque Option type that records information in an internal struct. The constructor accepts a variadic number of these options and applies them to configure the result.

When to Use

Use functional options when:

  • 3+ optional arguments on constructors or public APIs
  • Extensible APIs that may gain new options over time
  • Clean caller experience is important (no need to pass defaults)

The Pattern

Core Components

Related skills

More from cxuu/golang-skills

Installs
532
GitHub Stars
90
First Seen
Jan 27, 2026