Array unpacking

How do I unpack the contents of an array as arguments to a function? Essentially, I am looking for the inverse of the slice function.

For example, say I have a variable $params containing an array of alternating query keys and values. How do I call querify with those arguments?

In Python I would use *, and in Go I believe you use ..., but writing {{ querify $params... }} produces an error.

Maybe, as:

{{ range $key, $val := $params }}{{ querify $key $val }}{{ end }}
1 Like