-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
DocumentationIssues describing a change to documentation.Issues describing a change to documentation.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.
Milestone
Description
Go home page, Go 1.7.1.
Package text/template and html/template provide the same interface. But the documentation of text/template.Parse() and html/template.Parse() are different.
text/template.Parse() leaves out an important fact that it is an error to redefine a non-empty template. html/template.Parse() contains this important fact. But they work the same way.
I believe when {{block}} action was added in Go 1.6 and redefining of templates got allowed, only the doc of html/template.Parse() was updated but not text/template.Parse().
Example code that triggers this error:
template.Must(template.New("").Parse(`{{block "A" "a"}}a{{end}}{{define "A"}}b{{end}}`))
Playground link with text/template: https://play.golang.org/p/PY3zLcCFiu
Playground link with html/template: https://play.golang.org/p/UeQk4D3tcB
Metadata
Metadata
Assignees
Labels
DocumentationIssues describing a change to documentation.Issues describing a change to documentation.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.