How can I pass in Golang a function as an argument that can have potentially multiple arguments, e.g. fmt.Printf
?
The first problem is that one has to define the type of the function to be passed first.
type FunctionWithVariableArgumentLength func(s string, object1 type1, ..., objectn typen)
The second problem is that one does not know what types the arguments in the list may have, like in fmt.Printf
.