Skip to content

Commit

Permalink
fix retry example
Browse files Browse the repository at this point in the history
  • Loading branch information
cenkalti committed Dec 18, 2024
1 parent 7b9bd02 commit e2ea899
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package backoff

import (
"context"
"fmt"
"log"
)

func ExampleRetry() {
// An operation that may fail.
operation := func() (bool, error) {
return true, nil
operation := func() (string, error) {
return "hello", nil
}

_, err := Retry(context.TODO(), operation, WithBackOff(NewExponentialBackOff()))
Expand All @@ -18,6 +19,9 @@ func ExampleRetry() {
}

// Operation is successful.

fmt.Println("hello")
// Output: hello
}

func ExampleTicker() {
Expand Down

0 comments on commit e2ea899

Please sign in to comment.