Skip to content

Commit

Permalink
Added PatchMethodWithMakeFunc func
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyredondo committed Jan 22, 2020
1 parent 8db8327 commit 0044123
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions patcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ func PatchMethodByReflect(target reflect.Method, redirection interface{}) (*Patc
}
return patch, nil
}
func PatchMethodWithMakeFunc(target reflect.Method, fn func(args []reflect.Value) (results []reflect.Value)) (*Patch, error) {
rValue := reflect.MakeFunc(target.Type, fn)
return PatchMethodByReflect(target, rValue)
}

func (p *Patch) Patch() error {
if p == nil {
Expand Down

0 comments on commit 0044123

Please sign in to comment.