From ef219c3c35fc50342547ccde9e98db80fb5fa874 Mon Sep 17 00:00:00 2001 From: justinsb Date: Sun, 13 Oct 2024 09:00:29 -0400 Subject: [PATCH] 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) --- upup/pkg/fi/context.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/upup/pkg/fi/context.go b/upup/pkg/fi/context.go index 03e81c2f00..bbd8c33483 100644 --- a/upup/pkg/fi/context.go +++ b/upup/pkg/fi/context.go @@ -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 }