How do I make template.Execute write the generated html to a string
instead of a Writer object ? Is there a StringWriter or some such
class that I can make use of ? If I have to write into some other
writer and then read from it, what writer should I use best for this
scenario ?
On Wednesday, May 2, 2012 12:43:49 PM UTC-5, Sankar wrote:
> Hi,
> How do I make template.Execute write the generated html to a string > instead of a Writer object ? Is there a StringWriter or some such > class that I can make use of ? If I have to write into some other > writer and then read from it, what writer should I use best for this > scenario ?
> On Wednesday, May 2, 2012 12:43:49 PM UTC-5, Sankar wrote:
>> Hi,
>> How do I make template.Execute write the generated html to a string
>> instead of a Writer object ? Is there a StringWriter or some such
>> class that I can make use of ? If I have to write into some other
>> writer and then read from it, what writer should I use best for this
>> scenario ?
On Thu, May 3, 2012 at 12:28 AM, Russ Cox <r...@golang.org> wrote:
> On Wed, May 2, 2012 at 2:24 PM, Sankar P <sankar.curios...@gmail.com> wrote:
>> var doc bytes.Buffer
>> t.Execute(&doc, survey)
>> s := doc.String()
> It will work even better if you check for an error from t.Execute.