Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
retry
✓ github.com/avast/retry-go/v3
Retry an HTTP GET request with default retry policy.
package main
import (
"fmt"
"io/ioutil"
"net/http"
"github.com/avast/retry-go/v3"
)
func main() {
url := "http://example.com"
var body []byte
err := retry.Do(
func() error {
resp, err := http.Get(url)
if err != nil {
return err
}
defer resp.Body.Close()
body, err = ioutil.ReadAll(resp.Body)
if err != nil {
return err
}
return nil
},
)
if err != nil {
fmt.Println("Failed:", err)
} else {
fmt.Println(string(body))
}
}
Debug
Known issues
No known issues recorded.
Upgrade
Version history
3.1.1latest on pkg.go.dev
Audit
Dependencies
No dependency data recorded yet.