Retry operation executor with init and clean up functions
ctx := context.Background()
value := 5
Retry(
ctx,
func(_ context.Context, v interface{}) error {
if &value != v {
return fmt.Errorf("Value diff")
}
return nil
},
Init(func(ctx context.Context) (interface{}, error) {
return &value, nil
}),
Clean(func(ctx context.Context, v interface{}, e error) error {
if &value != v {
return fmt.Errorf("Value diff")
}
return e
}),
)