package rollouts import "time" type TimeSource interface { Now() time.Time } type Option func(*options) func WithTimeSource(ts TimeSource) Option { return func(o *options) { o.timeSource = ts } } type options struct { timeSource TimeSource } func makeOptions(opts ...Option) *options { o := &options{ timeSource: defaultTimeSource{}, } for _, opt := range opts { opt(o) } return o } type defaultTimeSource struct{} func (d defaultTimeSource) Now() time.Time { return time.Now() }