{"id":20298313,"url":"https://github.com/for-acgn/monkey","last_synced_at":"2025-10-16T23:04:48.913Z","repository":{"id":158752167,"uuid":"634216592","full_name":"For-ACGN/monkey","owner":"For-ACGN","description":"monkey is a library to make patch for unit tests","archived":false,"fork":false,"pushed_at":"2024-03-17T11:46:17.000Z","size":94,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-14T10:19:59.528Z","etag":null,"topics":["monkey","patch"],"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/For-ACGN.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":"2023-04-29T12:22:13.000Z","updated_at":"2024-02-05T12:24:41.000Z","dependencies_parsed_at":"2024-03-17T12:46:11.731Z","dependency_job_id":null,"html_url":"https://github.com/For-ACGN/monkey","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/For-ACGN%2Fmonkey","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/For-ACGN%2Fmonkey/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/For-ACGN%2Fmonkey/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/For-ACGN%2Fmonkey/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/For-ACGN","download_url":"https://codeload.github.com/For-ACGN/monkey/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241794138,"owners_count":20021192,"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":["monkey","patch"],"created_at":"2024-11-14T16:09:09.131Z","updated_at":"2025-10-16T23:04:43.847Z","avatar_url":"https://github.com/For-ACGN.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# monkey\nmonkey is a library to make patch for unit tests, this repository modified some from [gomonkey](https://github.com/agiledragon/gomonkey).\\\nit can patch exported/unexported methods from exported/unexported structure.\n\n## Example\n### Patch function\n```go\npatch := func(a ...interface{}) (int, error) {\n    return fmt.Print(\"what?!\")\n}\npg := monkey.Patch(fmt.Println, patch)\ndefer pg.Unpatch()\n\n// output: what?!\nfmt.Println(\"hello!\")\n```\n\n### Patch method\n#### with receiver\n```go\nvar r *bytes.Reader\npatch := func(*bytes.Reader, b []byte) (int, error) {\n    return 0, nil\n}\npg := monkey.PatchMethod(r, \"Read\", patch)\ndefer pg.Unpatch()\n\nreader := bytes.NewReader([]byte(\"hello\"))\nbuf := make([]byte, 1024)\n\n// output: 0 \u003cnil\u003e\nfmt.Println(reader.Read(buf))\n```\n#### ignore receiver\n```go\nvar r *bytes.Reader\npatch := func(b []byte) (int, error) {\n    return 0, nil\n}\npg := monkey.PatchMethod(r, \"Read\", patch)\ndefer pg.Unpatch()\n\nreader := bytes.NewReader([]byte(\"hello\"))\nbuf := make([]byte, 1024)\n\n// output: 0 \u003cnil\u003e\nfmt.Println(reader.Read(buf))\n```\n\n## Original\nhttps://github.com/bouk/monkey  \nhttps://github.com/agiledragon/gomonkey\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffor-acgn%2Fmonkey","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffor-acgn%2Fmonkey","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffor-acgn%2Fmonkey/lists"}