I assume this was just an oversight. I was expecting that any specified options would override defaults, but unspecified options would still use the default options.
IE:
// Given
defaultOptions := &Options{
expiration: 25 * time.Second,
}
// When
options := applyOptionsWithDefault(defaultOptions, WithCost(7))
// Then
assert.Equal(t, int64(7), options.cost)
assert.Equal(t, 25*time.Second, options.expiration)
I assume this was just an oversight. I was expecting that any specified options would override defaults, but unspecified options would still use the default options.
IE: