Guys, I’m struggling with a problem here, maybe someone could help. I have a previously defined function, which I need to execute that function inside another function, passed by parameter, one of the parameters of that function the type can change, example of what I’m trying to do in playground;
PS: I dont have access to doSomthingA and doSomthingB functions code, those functions are generated and the second parameter type arg2 change the type name.
I think the problem is the signature of functions doSomethingA and doSomethingB, i mean
you are using func(a string, b interface{}) and the signature are func doSomethingA(arg1 string, arg2 typeA) and doSomethingA(arg1 string, arg2 typeB)
You can use generics or reflection or simply just change the signature of both functions to arg2 interface{} and change the code in your functions to: