golang `text/template` parsing

1 · Nelson Elhage · Nov. 17, 2016, 6:58 p.m.
Go’s text/template package implements a templating system for Go. Like many templating systems, when it loads a template it parses it into an AST, which can then be walked to render the template against one or more inputs. AST nodes in the template AST hold the line number from which that element was parsed, primarily for better error-reporting. In go1.7.3 and earlier, as the AST is walked, the line number field of each element is filled in by counting the newlines since the start of the file. O...