A Go library for injecting controlled failures into code for testing error handling and fault tolerance.
Failpoint is a Go implementation of the failpoint concept, enabling developers to inject controlled failures—such as errors, panics, delays, or custom behaviors—at specific points in their code. It allows for reproducible testing of error handling, fault tolerance, and edge cases by activating these injection points via environment variables or programmatic control. The tool is designed to be minimally invasive, with zero runtime overhead in production, as the failpoint code is removed from final binaries when disabled.
Go developers and engineers building distributed systems, databases, or any application requiring robust fault tolerance and error handling testing. It is particularly useful for teams implementing chaos engineering practices or needing to simulate failure scenarios in a controlled manner.
Developers choose failpoint over alternatives because it offers zero runtime cost in production, as failpoint code is completely removed from binaries when disabled. Its compiler-checked syntax ensures reliability by catching errors during compilation, and it maintains original line numbers in rewritten code for easier debugging, unlike comment-based or runtime-heavy approaches.
An implementation of failpoints for Golang.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Failpoint code is completely removed from final binaries when disabled, ensuring no performance impact in production, as emphasized in the README's design principles.
Failpoints are written as valid Go code, catching syntax errors during compilation for greater reliability compared to comment-based alternatives.
Supports environment variable patterns (e.g., return, sleep, panic) and programmatic hooks via context.Context, enabling precise failure simulation in tests.
Maintains original line numbers in transformed code, making it easier to trace failures back to source locations without obfuscation.
Requires using failpoint-ctl or failpoint-toolexec for code transformation, adding extra steps to compilation and potentially complicating integration with existing toolchains.
Failpoints share a package-level namespace, risking conflicts if not carefully named, a limitation acknowledged in the README's best practices section.
The InjectCall marker function cannot be activated via GO_FAILPOINTS environment variables, restricting it to programmatic enablement and reducing flexibility for some use cases.