Registry / testing / agiledragon-gomonkey-v2

agiledragon-gomonkey-v2

JSON →
library2.14.0gogounverified

A Go library for monkey patching functions and methods at runtime for testing.

go get github.com/agiledragon/gomonkey/v2
INSTALL
IMPORT
SIG · AGILEDRAGON-GOMONK
A
agiledragon-gomonkey-v2
testinggov2.14.0
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.

gomonkey
github.com/agiledragon/gomonkey/v2

Patches fmt.Println to do nothing.

package main import ( "fmt" "github.com/agiledragon/gomonkey/v2" ) func main() { patches := gomonkey.ApplyFunc(fmt.Println, func(a ...interface{}) (n int, err error) { return 0, nil }) defer patches.Reset() fmt.Println("hello") }
Debug
Known issues
gotchaGoMonkey may not work with Go versions that have updated the linker or inlining behavior.
fix
Ensure you are using a compatible Go version and disable inlining for the target function if needed.
affects: >=2.0.0
Upgrade
Version history
2.14.0latest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
47 hits · last 30 days
node
36
Meta
1
OpenAI (training)
1
Resources
agiledragon-gomonkey-v2 — go get agiledragon-gomonkey-v2 · libregistry