go-functional-options
CommunityDesign flexible APIs with functional options.
Software Engineering#go#api-design#functional-options#design-pattern#constructors#optional-parameters
Authorcxuu
Version1.0.0
Installs0
System Documentation
What problem does it solve?
API constructors with many optional parameters lead to brittle and hard-to-use code. The functional options pattern provides a flexible, scalable approach by decoupling configuration from constructors.
Core Features & Use Cases
- Unexported internal options struct to hold configuration
- Exported Option interface with an unexported apply method
- With* constructors to compose configuration
- Use cases include API constructors with 3+ optional parameters and future extensibility
Quick Start
Instantiate the API with default options and apply any number of With* options to customize behavior.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: go-functional-options Download link: https://github.com/cxuu/golang-skills/archive/main.zip#go-functional-options Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.