Skip to content

Options Reference

Options are configured via functional option constructors. Each function's API page documents which options it accepts. This page provides a consolidated overview.

Option Categories

CategoryInterfaceAccepted by
SharedGoOption + GroupOptionDo, Wait, WaitWithStop, WaitWithReady, Go, Start, StartWithReady, StartWithStop, GoWithCancel, NewGroup, Group.Add
Go-onlyGoOptionDo, Wait, WaitWithStop, WaitWithReady, Go, Start, StartWithReady, StartWithStop, GoWithCancel, Group.Add
Group-onlyGroupOptionNewGroup, All, Map

The compiler enforces these constraints. You cannot pass a groupOnlyOpt to Go() or a goOnlyOpt to NewGroup().

Defaults

When no options are passed, the following defaults apply:

SettingDefault
NameFunction-specific (e.g. "gofuncy.go", "gofuncy.group")
TracingEnabled
Started counterEnabled
Error counterEnabled
Active counterEnabled
Duration histogramDisabled
Error handler (Go/Start/StartWithReady/StartWithStop/GoWithCancel only)slog.ErrorContext
LimitNo limit
Fail-fastDisabled
RetryDisabled
Circuit breakerDisabled
FallbackDisabled

Resilience Chain Order

The framework applies resilience options in a fixed order, regardless of the order they appear in your code:

PositionMiddlewareBehavior
InnermostTimeoutEach invocation gets a fresh deadline
RetryRetries the timeout-wrapped function
Circuit BreakerSees the final outcome after all retries
OutermostFallbackLast resort -- catches everything

For custom ordering, use WithMiddleware with the middleware constructors (Retry(), Fallback(), etc.) directly.

Option Merging in Group.Add

When you pass options to Group.Add, they are merged on top of the group's options using these rules:

Field typeMerge rule
string (name)Override if non-empty
*slog.LoggerOverride if non-nil
[]MiddlewareAppend
time.DurationOverride if > 0
bool (metrics/tracing)OR (enable, never disable)
MeterProvider / TracerProviderOverride if non-nil
*semaphore.WeightedOverride if non-nil
*CircuitBreakerOverride if non-nil
Retry / FallbackOverride if set
limit, failFastNot merged (group-only)