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
I would be open to adding a function similar to Infer but with support for default values. I don't think I would want to increase the API to support typed variants of everything. In fact with generics released this library would look very different if I was to write it again today.
Some possible API's I may consider pull request for:
// All in one function that behaves like Infer but adds a default value.funcF(dst, v, defaultValueinterface{})
// Where F can be one of the below, or some other name that makes sense:InferWithDefaultInferDefaultInferWithWithDefaultDefault
Can add XXXWithDefault(v, defaultValue XXX) XXX
func XXXWithDefault(v, defaultValue XXX) XXX {
a, err := XXX(v)
if err == nil {
return a
}
return defaultValue
}
The text was updated successfully, but these errors were encountered: