Skip to content

Commit 0044123

Browse files
committed
Added PatchMethodWithMakeFunc func
1 parent 8db8327 commit 0044123

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

patcher.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ func PatchMethodByReflect(target reflect.Method, redirection interface{}) (*Patc
6565
}
6666
return patch, nil
6767
}
68+
func PatchMethodWithMakeFunc(target reflect.Method, fn func(args []reflect.Value) (results []reflect.Value)) (*Patch, error) {
69+
rValue := reflect.MakeFunc(target.Type, fn)
70+
return PatchMethodByReflect(target, rValue)
71+
}
6872

6973
func (p *Patch) Patch() error {
7074
if p == nil {

0 commit comments

Comments
 (0)