How to indent content of included template
I am using go templates to create yaml definitions for kubernetes. I am trying to nest templates but run into issues where I can't re-use a definition simply because the indention is wrong when included. I.e., in one case the contents need indentation but do not in another. How can I control the indention of included content? Example below. I am reusing pod.tmpl, in the first case it can be included as is. In the second case I need to indent the entire contents so it becomes member of service {{ if (eq .Case "pod") # NO indenting {{ template "pod" }} {{ end }} {{ if (eq .Case "service")