mirror of https://github.com/kubernetes/kops.git
chore: fix method-matching on Render method
This allows us to invoke methods that accept interfaces, and arguably the old logic was incorrect (though it worked in the case where we wanted exact type matches)
This commit is contained in:
parent
80e4a718c6
commit
ef219c3c35
|
@ -209,14 +209,14 @@ func (c *Context[T]) Render(a, e, changes Task[T]) error {
|
|||
var args []reflect.Value
|
||||
for j := 0; j < method.Type.NumIn(); j++ {
|
||||
arg := method.Type.In(j)
|
||||
if arg.ConvertibleTo(vType) {
|
||||
if vType.ConvertibleTo(arg) {
|
||||
continue
|
||||
}
|
||||
if arg.ConvertibleTo(typeContextPtr) {
|
||||
if typeContextPtr.ConvertibleTo(arg) {
|
||||
args = append(args, reflect.ValueOf(c))
|
||||
continue
|
||||
}
|
||||
if arg.ConvertibleTo(targetType) {
|
||||
if targetType.ConvertibleTo(arg) {
|
||||
args = append(args, reflect.ValueOf(c.Target))
|
||||
continue
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue