- Retrying made simple and easy for golang.
go get -u github.com/rafaeljesus/retry-gopackage main
import (
"time"
"github.com/rafaeljesus/retry-go"
)
func main() {
attempts := 3
sleepTime := time.Second*2
if err := retry.Do(func() error {
return work()
}, attempts, sleepTime); err != nil {
// Retry failed
}
}package main
import (
"time"
"github.com/rafaeljesus/retry-go"
)
func main() {
attempts := 3
sleepTime := time.Second*2
if err := retry.DoHTTP(func() (*http.Response, error) {
return makeRequest()
}, attempts, sleepTime); err != nil {
// Retry failed
}
}- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request
GitHub @rafaeljesus · Medium @_jesus_rafael · Twitter @_jesus_rafael