From: Mathias Gibbens Description: Updates for golang-github-lestrrat-go-option v2 Forwarded: not-needed diff --git a/constant.go b/constant.go index a7b75e5..25341ea 100644 --- a/constant.go +++ b/constant.go @@ -18,11 +18,11 @@ func NewConstantInterval(options ...ConstantOption) *ConstantInterval { for _, option := range options { switch option.Ident() { case identInterval{}: - interval = option.Value().(time.Duration) + _ = option.Value(&interval) case identJitterFactor{}: - jitterFactor = option.Value().(float64) + _ = option.Value(&jitterFactor) case identRNG{}: - rng = option.Value().(Random) + _ = option.Value(&rng) } } diff --git a/controller.go b/controller.go index 1d6c721..24cfd6e 100644 --- a/controller.go +++ b/controller.go @@ -25,7 +25,7 @@ func newController(ctx context.Context, ig IntervalGenerator, options ...Control for _, option := range options { switch option.Ident() { case identMaxRetries{}: - maxRetries = option.Value().(int64) + _ = option.Value(&maxRetries) } } diff --git a/exponential.go b/exponential.go index 93aafd3..acae2be 100644 --- a/exponential.go +++ b/exponential.go @@ -24,20 +24,23 @@ func NewExponentialInterval(options ...ExponentialOption) *ExponentialInterval { maxInterval := defaultMaxInterval minInterval := defaultMinInterval multiplier := defaultMultiplier + var dur time.Duration var rng Random for _, option := range options { switch option.Ident() { case identJitterFactor{}: - jitterFactor = option.Value().(float64) + _ = option.Value(&jitterFactor) case identMaxInterval{}: - maxInterval = float64(option.Value().(time.Duration)) + _ = option.Value(&dur) + maxInterval = float64(dur) case identMinInterval{}: - minInterval = float64(option.Value().(time.Duration)) + _ = option.Value(&dur) + minInterval = float64(dur) case identMultiplier{}: - multiplier = option.Value().(float64) + _ = option.Value(&multiplier) case identRNG{}: - rng = option.Value().(Random) + _ = option.Value(&rng) } }