text template range over Rangefunc

179 views
Skip to first unread message

Ajay Kidave

unread,
Mar 4, 2024, 2:46:50 PM3/4/24
to golang-nuts
The https://go.dev/wiki/RangefuncExperiment change will be a great addition to the language. I wanted to know whether the text/html template std libraries will allow range over rangefunc. Currently, the doc for text/template says

{{range pipeline}} T1 {{end}}
The value of the pipeline must be an array, slice, map, or channel

It would be great if rangefunc is supported in templates. The specific use case for me is passing a rangefunc created on a sql row iterator to a template.

Ian Lance Taylor

unread,
Mar 4, 2024, 5:11:59 PM3/4/24
to Ajay Kidave, golang-nuts
Makes sense to me. Do you want to open a proposal at
https://go.dev/issue to add this to the template package? Thanks.

Ian

Ajay Kidave

unread,
Mar 4, 2024, 5:34:26 PM3/4/24
to golang-nuts
Sure, created a proposal at https://github.com/golang/go/issues/66107

Ajay
Reply all
Reply to author
Forward
0 new messages