{"repo":"xhd2015/xgo","free":true,"listed":false,"github":"https://github.com/xhd2015/xgo","clone":"git clone https://github.com/xhd2015/xgo.git","description":"All-in-one go testing library","language":"Go","stars":431,"topics":["go","golang","instrumentation","mock","monkey-patching","testing","gomonkey","go-test","go-testing","testing-library"],"license":"MIT","category":"dev-tools","readme_excerpt":"xgo English 简体中文 xgo provides all-in-one test utilities for golang, including: - API: - Mock - Trace - Trap - Tools: - Test Explorer - Incremental Coverage - IDE Setup As for the monkey patching part, xgo works as a preprocessor for go run , go build , and go test (see our blog). See Quick Start and Documentation for more details. By the way, I promise you this is an interesting project. Installation Verify the installation: If xgo is not found, you may need to check if $GOPATH/bin is added to your PATH variable. For CI jobs like github workflow, see doc/INSTALLATION.md. Requirement xgo requires at least go1.17 to compile. There is no specific limitation on OS and Architecture. All OS and Architectures are supported by xgo as long as they are supported by go . x86 x86 64 (amd64) arm64 any other Arch... :--------- :-----------: :-----------: :-----------: :-----------: Linux Y Y Y Y Windows Y Y Y Y macOS Y Y Y Y any other OS... Y Y Y Y Quick Start Let's write a unit test with xgo : 1. Ensure you have installed xgo by following the Installation section, and verify the installation with: 2. Init a go project: 3. Add demo test.go : 4. Get the github.com/xhd2015/xgo/runtime dependency: 5. Test the code: Output: NOTE: xgo is used to test your code, not just go . Under the hood, xgo preprocess your code to add mock hooks, and then calls go to do remaining jobs. The above code can be found at doc/demo. API Patch Patch given function within current goroutine. The API: - Patch(fn,repla","default_branch":null,"files":null,"tree":[],"storefront":"/r/xhd2015","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/xhd2015/xgo/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."}