15 строки
324 Б
Go
15 строки
324 Б
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)
|
|
}
|