Let's say I have a basic go text/template:
{{.var}} is another {{.var2}}
I want to get an array of the variables names used in the template, to be able to skip the execution if they are not available in the data I pass to execute, is it possible to do that somehow?
As my data is not a struct but a map, doing .var will always return something: if it doesn't exist, it will return an empty string when I would have hoped to get an error when executing the template.
So for the example from above, I would have liked to get:
[var var2]