diff --git a/src/text/template/parse/parse.go b/src/text/template/parse/parse.go index 7c35b0ff3d..c9b80f4a24 100644 --- a/src/text/template/parse/parse.go +++ b/src/text/template/parse/parse.go @@ -108,13 +108,8 @@ func (t *Tree) nextNonSpace() (token item) { } // peekNonSpace returns but does not consume the next non-space token. -func (t *Tree) peekNonSpace() (token item) { - for { - token = t.next() - if token.typ != itemSpace { - break - } - } +func (t *Tree) peekNonSpace() item { + token := t.nextNonSpace() t.backup() return token }