Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Go
  3. retry-go

retry-go

MITGov5.0.0

A simple and flexible Go library for implementing retry mechanisms with configurable backoff strategies and error handling.

Visit WebsiteGitHubGitHub
2.9k stars177 forks0 contributors

What is retry-go?

retry-go is a Go library that implements a retry mechanism for operations that may fail intermittently. It provides a simple API to automatically retry failed function calls with configurable attempts, delays, and backoff strategies, helping developers build more resilient applications.

Target Audience

Go developers building applications that interact with external services, networks, or other unreliable systems where transient failures are common.

Value Proposition

Developers choose retry-go for its clean, intuitive API, performance optimizations like reusable retriers, and extensive customization options including multiple delay strategies and fine-grained error control, all while maintaining simplicity.

Overview

Simple golang library for retry mechanism

Use Cases

Best For

  • Retrying HTTP requests to external APIs that may fail intermittently
  • Handling transient database connection failures in Go applications
  • Implementing exponential backoff with jitter for distributed systems
  • Adding resiliency to file I/O operations in CLI tools
  • Wrapping unreliable third-party library calls with retry logic
  • Building robust microservices that need to handle network flakiness

Not Ideal For

  • Projects where retry logic is trivial and a simple for-loop suffices, avoiding library overhead
  • Applications requiring asynchronous or non-blocking retry patterns, as retry-go operates synchronously with blocking calls
  • Teams heavily invested in the v4 API who find the v5 breaking changes too disruptive for migration
  • Use cases needing highly specialized backoff algorithms not covered by built-in delay strategies, like Fibonacci or adaptive external metrics

Pros & Cons

Pros

Clean Method-Based API

The v5 redesign uses an intuitive retry.New().Do() syntax, simplifying integration as shown in HTTP examples, moving away from the older functional options pattern.

Performance with Reusable Retriers

Creating retrier instances once minimizes allocations in success cases, optimizing high-frequency operations, as highlighted in the reusable retrier example.

Flexible Delay Strategies

Supports fixed, exponential backoff, random jitter, and custom DelayTypeFunc, enabling precise control over retry timing through functions like FullJitterBackoffDelay.

Comprehensive Error Handling

Features like Unrecoverable() and RetryIf() allow marking errors as non-retryable and filtering retry conditions, with detailed examples in the README.

Cons

Frequent Breaking Changes

Multiple major version updates (v5, v4, v3) with API redesigns, such as switching to method-based calls and changing error unwrapping, can break existing code and require migration efforts.

Complex Error Unwrapping

In v5, Unwrap() returns []error instead of a single error, complicating error inspection compared to standard Go practices and requiring adaptation with LastError() or errors.Is.

Steeper Learning for Customization

Creating custom DelayTypeFunc requires understanding the DelayContext interface, adding complexity for advanced use cases beyond the built-in strategies.

Frequently Asked Questions

Quick Stats

Stars2,940
Forks177
Contributors0
Open Issues8
Last commit5 months ago
CreatedSince 2017

Tags

#retry-logic#hacktoberfest#go-library#backoff-strategies#retry#transient-failures#error-handling#exponential-backoff#golang#go#resiliency

Built With

G
Go

Links & Resources

Website

Included in

Go169.1k
Auto-fetched 5 hours ago

Related Projects

fzffzf

:cherry_blossom: A command-line fuzzy finder

Stars81,940
Forks2,820
Last commit21 hours ago
divedive

A tool for exploring each layer in a docker image

Stars54,353
Forks1,991
Last commit7 months ago
HubHub

A command-line tool that makes git easier to use with GitHub.

Stars22,957
Forks2,222
Last commit2 years ago
lolo

💥 A Lodash-style Go library based on Go 1.18+ Generics (map, filter, contains, find...)

Stars21,394
Forks946
Last commit19 hours ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub