Hi,
How can I pass global variables to the sub-templates?
Example:
{{- set $ "global" "text" }}
{{ $.global }}
{{ $v := dict "key" "value" }}
{{ template "T1" $v }}
{{- define "T1" }}
{{ $.global }}
{{ .key }}
{{- end }}
Result:
❯ gotemplate --print main.template
template: main.template:: contains undefined value(s)
1
2 text
3
4
5
6 <no value>
7 value
8
The same with include function.