agiledragon/gomonkey
gomonkey is a library to make monkey patching in unit tests easy observed · 2026-08-28
Health v2 · maintenance only
85/100
- Activity 95
- Release rhythm 64
- Longevity 100
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-09-02. Adoption (stars, forks) is never an input.
- gap_med: 202
- age_days: 2940
- days_rel: 31
- days_push: 31
- n_releases_24m: 4
Adoption not part of the score
2262 stars · 191 forks observed · 2026-08-28
What it is AI-extracted, prompt v1, taxonomy v1, 2026-08-30, confidence not recorded
gomonkey is a Go library that makes monkey patching in unit tests easy, allowing functions, member methods, interfaces, function variables, and global variables to be replaced at runtime. It supports sequential patches for repeated calls and works across amd64, arm64, 386, loong64, and riscv64 architectures.
Use cases
- mock functions in go unit tests
- patch private methods during testing
- stub interface method calls in tests
- replace global variables in test code
- mock a function to return different values on successive calls
- patch member methods without dependency injection
When to choose
- you need to patch unexported/private functions or methods in Go tests
- you cannot refactor code to use interfaces or dependency injection
- you need a function to return different values on successive calls
- you want to stub external dependencies without changing production code
When to avoid
- you need thread-safe patching while other goroutines call the patched function
- you cannot disable compiler inlining with -gcflags=all=-l
- you want portable, idiomatic mocking via interfaces instead of runtime patching
- your target platform or architecture is unsupported
Facets
library · maturity active
testing mocking testing developer-tools windows go monkey-patching unit-testing go test-doubles runtime-patching linux macos
1 source
- readme: https://github.com/agiledragon/gomonkey · fetched 2026-08-28 · c3088c10091b
Member repositories
| Repository | Role | Health v2 |
|---|---|---|
| agiledragon/gomonkey | main | 85 |
For agents
markdown · JSON · MCP: product_card(name="agiledragon/gomonkey")
Data as of 2026-08-30T08:39:29.467469+00:00 · Report a problem