Skip to content

text/template: (also html/template?) range on channel gotcha #7986

@gopherbot

Description

@gopherbot

by krolaw:

This relate's in part to issue #7445.

Currently Execute is documented as:
Execute applies a parsed template to the specified data object, and writes the output to
wr.

I believe it should say that if a write error is encountered, the remainder of the
template will not be executed.

I discovered this behaviour when serving templates over http, ranging over a channel,
which was populated by a goroutine.  If the network connection prematurely closed, the
goroutine would lock up/memory leak.

This might also be worth a mention with the range command when dealing with channels.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions