gopkg is a collection of reusable, robust Go packages and utilities designed to accelerate backend development.
goslack: Utilities for interacting with Slack.httpclient: A robust HTTP client wrapper.logger: Structured logging configuration and hooks (e.g., usingzerolog).otel: OpenTelemetry integrations for tracing and metrics.pgxtype: Extensions and utilities for working with PostgreSQL viapgx.retry: Robust retry logic with exponential backoff support.
go get github.com/anazcodes/gopkgpackage main
import (
"context"
"fmt"
"time"
"github.com/anazcodes/gopkg/retry"
)
func main() {
r := retry.Retryer{
MaxRetries: 3,
Delay: 1 * time.Second,
Backoff: true,
}
err := r.Do(context.Background(), func() error {
// Your logic here
return fmt.Errorf("temporary error")
})
if err != nil {
fmt.Println("Failed after retries:", err)
}
}Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.