Registry / testing / bouk-monkey

bouk-monkey

JSON →
library1.0.2gogounverified

Package monkey provides a way to monkey patch functions in Go for testing purposes.

go get github.com/bouk/monkey
INSTALL
IMPORT
SIG · BOUK-MONKEY
B
bouk-monkey
testinggov1.0.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

monkey
github.com/bouk/monkey

Patches fmt.Println to always print 'patched'.

package main import ( "fmt" "github.com/bouk/monkey" ) func main() { monkey.Patch(fmt.Println, func(a ...interface{}) (n int, err error) { return fmt.Println("patched") }) fmt.Println("hello") }
Debug
Known issues
gotchaMonkey patching is unsafe and may cause crashes or undefined behavior in production.
fix
Use only in test code; avoid in production.
affects: all
Upgrade
Version history
1.0.2latest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
19 hits · last 30 days
node
16
Amazon
1
OpenAI (training)
1
Resources
bouk-monkey — go get bouk-monkey · libregistry