ktgo/pkg/testlib/patching.go
2024-02-19 16:53:07 +03:00

19 строки
427 Б
Go

package testlib
import (
"unicode"
. "github.com/agiledragon/gomonkey/v2"
)
func Patch(target interface{}, methodName string, double interface{}) *Patches {
c := []rune(methodName)[0]
if unicode.IsUpper(c) {
return ApplyMethod(target, methodName, double)
}
return ApplyPrivateMethod(target, methodName, double)
}
func PatchFunc(target interface{}, double interface{}) *Patches {
return ApplyFunc(target, double)
}