{"id":13601084,"url":"https://github.com/agiledragon/gomonkey","last_synced_at":"2025-12-28T09:37:16.094Z","repository":{"id":38285960,"uuid":"144856759","full_name":"agiledragon/gomonkey","owner":"agiledragon","description":"gomonkey is a library to make monkey patching in unit tests easy","archived":false,"fork":false,"pushed_at":"2025-02-11T15:10:33.000Z","size":97,"stargazers_count":2130,"open_issues_count":59,"forks_count":183,"subscribers_count":27,"default_branch":"master","last_synced_at":"2025-04-09T03:02:34.589Z","etag":null,"topics":["function","function-variable","global-variable","gomonkey","interface","member-method","patch","private-method","sequence"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/agiledragon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-15T13:29:19.000Z","updated_at":"2025-04-09T01:03:46.000Z","dependencies_parsed_at":"2023-12-10T02:25:16.342Z","dependency_job_id":"f1b5ce90-2710-49e9-9add-180b10fea84e","html_url":"https://github.com/agiledragon/gomonkey","commit_stats":{"total_commits":103,"total_committers":21,"mean_commits":4.904761904761905,"dds":"0.30097087378640774","last_synced_commit":"d56c6823ec17473b7f5634cc44be83e9f38dd403"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agiledragon%2Fgomonkey","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agiledragon%2Fgomonkey/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agiledragon%2Fgomonkey/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agiledragon%2Fgomonkey/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/agiledragon","download_url":"https://codeload.github.com/agiledragon/gomonkey/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250561457,"owners_count":21450425,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["function","function-variable","global-variable","gomonkey","interface","member-method","patch","private-method","sequence"],"created_at":"2024-08-01T18:00:55.335Z","updated_at":"2025-12-28T09:37:16.045Z","avatar_url":"https://github.com/agiledragon.png","language":"Go","funding_links":[],"categories":["Misc","开源类库","Go","Open source library"],"sub_categories":["测试","Test"],"readme":"# gomonkey\n\ngomonkey is a library to make monkey patching in unit tests easy, and the core idea of monkey patching comes from [Bouke](https://github.com/bouk), you can read [this blogpost](https://bou.ke/blog/monkey-patching-in-go/) for an explanation on how it works.\n\n## Features\n\n+ support a patch for a function\n+ support a patch for a public member method\n+ support a patch for a private member method\n+ support a patch for a interface\n+ support a patch for a function variable\n+ support a patch for a global variable\n+ support patches of a specified sequence for a function\n+ support patches of a specified sequence for a member method\n+ support patches of a specified sequence for a interface\n+ support patches of a specified sequence for a function variable\n\n## Notes\n+ gomonkey fails to patch a function or a member method if inlining is enabled, please running your tests with inlining disabled by adding the command line argument that is `-gcflags=-l`(below go1.10) or `-gcflags=all=-l`(go1.10 and above).\n+ A panic may happen when a goroutine is patching a function or a member method that is visited by another goroutine at the same time. That is to say, gomonkey is not threadsafe.\n\n## Supported Platform:\n\n- ARCH\n  - amd64\n  - arm64\n  - 386\n  - loong64\n  - riscv64\n\n- OS\n  - Linux\n  - MAC OS X\n  - Windows\n\n## Installation\n- below v2.1.0, for example v2.0.2\n```go\n$ go get github.com/agiledragon/gomonkey@v2.0.2\n```\n- v2.1.0 and above, for example v2.11.0\n```go\n$ go get github.com/agiledragon/gomonkey/v2@v2.11.0\n```\n\n## Test Method\n```go\n$ cd test \n$ go test -gcflags=all=-l\n```\n\n## Using gomonkey\n\nPlease refer to the test cases as idioms, very complete and detailed.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagiledragon%2Fgomonkey","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagiledragon%2Fgomonkey","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagiledragon%2Fgomonkey/lists"}