I am using templates
with Golang and at some point I use this code:
t.Execute(os.Stdout, xxx);
This code above outputs the template to the screen (because of os.Stdout
) but I would like it to be assigned to a variable instead, something like
var temp string;
e := t.Execute(temp, xxx);
But of course, this code does not work. So how can I do this?