gomonkey is a library to make monkey patching in unit tests easy
ApplyMethodFunc
You can enjoy the private method feature for all go versions, the list of verified go versions as follows:
The target of mehod APIs no need to convert to reflect.Type.
go1.14 ok. go1.15 ok. go1.16 ok. go1.17 not ok, maybe because Go is about to support generics, the basic data structure has changed to some extent, including the reflect package.