go-playground / retry

:arrows_counterclockwise: Retry provides a set of standardized common components and abstracts away some code that normally is duplicated

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Retry library

Project status Build Status Coverage Status Go Report Card GoDoc License

Retry library provides a set of standardized common components and abstracts away some code that normally is duplicated. My motivation is not to reinvent the wheel but to standardize a set of components for reuse in other libraries.

Example

package main

import (
	"errors"
	"fmt"

	"github.com/go-playground/retry"
)

func main() {
	err := retry.Run(5, func() (bool, error) {
		return false, errors.New("ERR")
	},
		func(attempt uint16, err error) {
			fmt.Printf("Attempt: %d Error: %s\n", attempt, err)
		},
	)
	if err != nil {
		panic(err)
	}
}

Package Versioning

I'm jumping on the vendoring bandwagon, you should vendor this package as I will not be creating different version with gopkg.in like allot of my other libraries.

Why? because my time is spread pretty thin maintaining all of the libraries I have + LIFE, it is so freeing not to worry about it and will help me keep pouring out bigger and better things for you the community.

License

Distributed under MIT License, please see license file in code for more details.

About

:arrows_counterclockwise: Retry provides a set of standardized common components and abstracts away some code that normally is duplicated

License:MIT License


Languages

Language:Go 100.0%