main API

main

package

API reference for the main package.

F
function

main

examples/basic/main.go:11-25
func main()

{
	attempts := 0
	err := retry.Do(context.Background(), func() error {
		attempts++
		if attempts < 2 {
			return errors.New("temporary")
		}
		return nil
	}, 3)
	if err != nil {
		panic(err)
	}

	fmt.Printf("attempts: %d\n", attempts)
}