Capture or assign golang template output to variable
<p>Within a template, how can I achieve this?</p>

<pre><code>{{$var := template "my-template"}}
</code></pre>

<p>I just get <code>"unexpected &lt;template&gt; in operand"</code>.</p>