{"repo":"pingcap/failpoint","free":true,"listed":false,"github":"https://github.com/pingcap/failpoint","clone":"git clone https://github.com/pingcap/failpoint.git","description":"An implementation of failpoints for Golang.","language":"Go","stars":894,"topics":["golang","failpoint","fault-injection","failure-injection"],"license":"Apache-2.0","category":"dev-tools","readme_excerpt":"failpoint An implementation of [failpoints][failpoint] for Golang. Fail points are used to add code points where errors may be injected in a user controlled fashion. Fail point is a code snippet that is only executed when the corresponding failpoint is active. [failpoint]: http://www.freebsd.org/cgi/man.cgi?query=fail Quick Start (use failpoint-ctl ) 1. Build failpoint-ctl from source 2. Inject failpoints to your program, eg: 3. Transfrom your code with failpoint-ctl enable 4. Build with go build 5. Enable failpoints with GO FAILPOINTS environment variable Note: GO FAILPOINTS does not work with InjectCall type of marker. 6. If you use go run to run the test, don't forget to add the generated binding failpoint binding .go in your command, like: Quick Start (use failpoint-toolexec ) 1. Build failpoint-toolexec from source 2. Inject failpoints to your program, eg: 3. Use a separate build cache to avoid mixing caches without failpoint-toolexec , and build GOCACHE=/tmp/failpoint-cache go build -toolexec path/to/failpoint-toolexec 4. Enable failpoints with GO FAILPOINTS environment variable 5. You can also use go run or go test , like: Design principles - Define failpoint in valid Golang code, not comments or anything else - Failpoint does not have any extra cost - Will not take effect on regular logic - Will not cause regular code performance regression - Failpoint code will not appear in the final binary - Failpoint routine is writable/readable and should be checked by a compiler","default_branch":null,"files":null,"tree":[],"storefront":"/r/pingcap","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/pingcap/failpoint/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}