Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

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

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

go-fault

MITGo

A Go HTTP middleware library for injecting faults like latency, errors, and request rejection into services for resilience testing.

Visit WebsiteGitHubGitHub
554 stars24 forks0 contributors

What is go-fault?

Fault is a Go library that provides HTTP middleware for injecting controlled faults into web services. It enables developers to simulate failure scenarios like latency spikes, HTTP errors, and request rejection to test system resilience and error handling. The package integrates seamlessly with standard Go HTTP handlers and allows fine-grained control over when and where faults are injected.

Target Audience

Go developers building HTTP services who need to test failure resilience, particularly those working on microservices architectures or distributed systems where fault tolerance is critical.

Value Proposition

Developers choose Fault for its simple middleware-based approach, minimal performance overhead when disabled, and built-in injectors for common failure scenarios without requiring external dependencies or complex setup.

Overview

go fault injection library

Use Cases

Best For

  • Testing service resilience against latency spikes in production-like environments
  • Simulating backend HTTP errors to verify client error handling
  • Validating circuit breaker and retry logic in microservices architectures
  • Performing chaos engineering experiments in Go-based HTTP services
  • Creating controlled failure scenarios for disaster recovery testing
  • Benchmarking system performance under partial failure conditions

Not Ideal For

  • Simulating dropped requests where no HTTP response is sent (e.g., network timeouts or connection resets)
  • Non-Go projects or services not built on Go's standard net/http package
  • Chaos engineering requiring automated, multi-service fault injection with integrated monitoring
  • Testing failure scenarios beyond HTTP layers, such as database or filesystem errors

Pros & Cons

Pros

Minimal Performance Impact

Benchmarks in the README show negligible overhead when faults are disabled (e.g., 1771 ns/op vs 1734 ns/op without faults), making it safe for production use.

Easy Middleware Integration

Seamlessly works with standard Go HTTP handlers, as shown in the usage example where a fault wraps a main handler with a few lines of code.

Fine-Grained Control

Supports percentage-based participation and path filtering (e.g., blocklisting /ping and /health), allowing targeted fault injection without affecting critical endpoints.

Modular and Safe Design

Separates injectors for failures and fault logic for execution, prioritizing safety and minimal disruption during normal operation, per the philosophy section.

Cons

Limited to HTTP Faults

Only handles HTTP-based failures via middleware; it cannot simulate other system-level faults like network partitioning or database outages without custom extensions.

Imperfect Dropped Request Simulation

The README admits the RejectInjector always sends a response, so simulating truly dropped requests requires a workaround with a SlowInjector, which may not be realistic.

No Built-in Monitoring

Lacks integrated dashboards or alerting for chaos engineering experiments, requiring developers to manually track and analyze fault injection effects.

Go-Only Ecosystem

Tightly coupled to Go's HTTP stack, so it's not suitable for polyglot microservices or projects using other languages without significant adaptation.

Frequently Asked Questions

Quick Stats

Stars554
Forks24
Contributors0
Open Issues1
Last commit10 days ago
CreatedSince 2020

Tags

#http-middleware#reliability#resilience-testing#fault-injection#microservices#testing-tools#chaos-engineering#go

Built With

G
Go

Links & Resources

Website

Included in

Go169.1k
Auto-fetched 17 hours ago

Related Projects

CORSCORS

Go net/http configurable handler to handle CORS requests

Stars2,893
Forks233
Last commit1 month ago
TollboothTollbooth

Simple middleware to rate-limit HTTP requests.

Stars2,860
Forks209
Last commit1 year ago
LimiterLimiter

Dead simple rate limit middleware for Go.

Stars2,341
Forks163
Last commit1 year ago
ln-paywallln-paywall

Go middleware for monetizing your API on a per-request basis with Bitcoin and Lightning ⚡️

Stars158
Forks8
Last commit7 years 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