Apply - Programming - Apply Function - Go


In Go, typed variadic arguments are simply collected in a slice. The caller can explicitly pass in a slice in place of the variadic arguments, by appending a ... to the slice argument. This can only be done for a variadic parameter. The caller can not apply an array of arguments to non-variadic parameters, without using reflection..

s := string{"foo", "bar"} variadicFunc(s...)

Read more about this topic:  Apply, Programming, Apply Function