Is there any way to "spread" parameters in Go templates?
In my code I have a function that returns the properties of a list of structs as a string slice
"colStr": func(col string, a ...interface{}) []string {
s := make([]string, len(a))
for i, v := range a {
if structs.IsStruct(v) {
s[i] = db.Str(structs.Map(v)[col])
}
}
return s
},
But how do I pass to this function? In the template itself, I have something that looks like this
{{list (colStr `Number` .QuoteProofs...) `&`}}{{end}}
But that gives me
template: HTML:17: unexpected <.> in operand
Is there any way to do this with templates?