diff options
Diffstat (limited to 'src/text/template/parse/parse.go')
| -rw-r--r-- | src/text/template/parse/parse.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/text/template/parse/parse.go b/src/text/template/parse/parse.go index af33880c15..d0efcbf609 100644 --- a/src/text/template/parse/parse.go +++ b/src/text/template/parse/parse.go @@ -288,11 +288,12 @@ func (t *Tree) parse(treeSet map[string]*Tree) (next Node) { } t.backup2(delim) } - n := t.textOrAction() - if n.Type() == nodeEnd { + switch n := t.textOrAction(); n.Type() { + case nodeEnd, nodeElse: t.errorf("unexpected %s", n) + default: + t.Root.append(n) } - t.Root.append(n) } return nil } |
