You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
WithClientConfig overrides default ClientConfig values with zero values. #220
While using the Go Typesense client (v3.2.0), I noticed a potential configuration issue related to the functional options pattern and default configuration handling.
In NewClient, a default ClientConfig is initialized with sensible default values:
If only a subset of fields is provided (e.g., only ServerURL and APIKey), the remaining fields are Go zero values and overwrite the defaults set in NewClient.
// implement option pattern
for _, opt := range opts {
opt(c)
}
Question / Clarification
1. Is it the intended behavior that WithClientConfig fully overrides all defaults?
2. Specifically, should NumRetries (and other retry-related fields) have a non-zero default if not explicitly provided?
@tharropoulos what about the default value for NumRetries? Currently it is zero. But I think it is the standard practice there would be default non-zero value for retries.
The default in every client library is the number of nodes + the nearest node (max is 4, default is 1 on single-node environments). The only fallback missing is another check for 3. But the behavior is in sync with the rest of the clients.
Activity
iv-anas commentedon Feb 16, 2026
@tharropoulos what about the default value for NumRetries? Currently it is zero. But I think it is the standard practice there would be default non-zero value for retries.
tharropoulos commentedon Feb 16, 2026
The default in every client library is the number of nodes + the nearest node (max is 4, default is 1 on single-node environments). The only fallback missing is another check for 3. But the behavior is in sync with the rest of the clients.