type Strategy … var DefaultExponential … type Exponential … // Backoff returns the amount of time to wait before the next retry given the // number of retries. func (bc Exponential) Backoff(retries int) time.Duration { … } var ErrResetBackoff … // RunF provides a convenient way to run a function f repeatedly until the // context expires or f returns a non-nil error that is not ErrResetBackoff. // When f returns ErrResetBackoff, RunF continues to run f, but resets its // backoff state before doing so. backoff accepts an integer representing the // number of retries, and returns the amount of time to backoff. func RunF(ctx context.Context, f func() error, backoff func(int) time.Duration) { … }