Closed
Description
This is a repost of #20523 with, hopefully, a more clear description.
Go templates currently do not support the break
nor the continue
keyword -- which surprises people trying a construct similar to the one below.
{{ range $i, $e := .SomeSlice }}
{{ if gt $i 2 }}
{{ break }}
{{ end }}
{{ $e }}
{{ end }}
/cc @igramnet
Metadata
Metadata
Assignees
Type
Projects
Relationships
Development
No branches or pull requests
Activity
[-]text/template: Add break and continue support[/-][+]proposal: text/template: add break and continue support[/+]odeke-em commentedon May 31, 2017
/cc @rsc @robpike and other text/template folks.
rsc commentedon Jun 5, 2017
It does seem a little reasonable. I wouldn't want labels (or goto), though. Thoughts, @robpike?
robpike commentedon Jun 5, 2017
It does seem reasonable but low priority.
[-]proposal: text/template: add break and continue support[/-][+]text/template: add break and continue support[/+]rsc commentedon Jun 12, 2017
CLs welcome for Go 1.10. Thanks.
gopherbot commentedon Sep 27, 2017
Change https://golang.org/cl/66410 mentions this issue:
text/template: add break, continue actions in ranges
gopherbot commentedon Feb 5, 2018
Change https://golang.org/cl/92155 mentions this issue:
text/template: revert CL 66410 "add break, continue actions in ranges"
17 remaining items
gopherbot commentedon Dec 21, 2021
Change https://golang.org/cl/373915 mentions this issue:
doc/go1.18: document {text,html}/template {break,continue} commands
doc/go1.18: document {text,html}/template {break,continue} commands