diff options
| author | qiulaidongfeng <2645477756@qq.com> | 2024-09-19 13:45:13 +0000 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2024-09-23 14:35:44 +0000 |
| commit | cfbd2e7b40fac7809a404c49c46106e259078a61 (patch) | |
| tree | a8d850b00b9e2b9c71df540f0f91cbff026864ce /src/text/template/doc.go | |
| parent | 0081f17f146140f5c02344bed16c530472fcdb0f (diff) | |
| download | go-cfbd2e7b40fac7809a404c49c46106e259078a61.tar.xz | |
text/template: support range-over-func
For #66107
Change-Id: I2fcd04bebe80346dbd244ab7ea09cbe6010b9d8e
GitHub-Last-Rev: 5ebf615db5889a04738c555c651e07c1fd287748
GitHub-Pull-Request: golang/go#68329
Reviewed-on: https://go-review.googlesource.com/c/go/+/596956
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/text/template/doc.go')
| -rw-r--r-- | src/text/template/doc.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/text/template/doc.go b/src/text/template/doc.go index 12f6fe0d1c..847f96b725 100644 --- a/src/text/template/doc.go +++ b/src/text/template/doc.go @@ -98,7 +98,8 @@ data, defined in detail in the corresponding sections that follow. {{if pipeline}} T1 {{else}}{{if pipeline}} T0 {{end}}{{end}} {{range pipeline}} T1 {{end}} - The value of the pipeline must be an array, slice, map, or channel. + The value of the pipeline must be an array, slice, map, iter.Seq, + iter.Seq2 or channel. If the value of the pipeline has length zero, nothing is output; otherwise, dot is set to the successive elements of the array, slice, or map and T1 is executed. If the value is a map and the @@ -106,7 +107,8 @@ data, defined in detail in the corresponding sections that follow. visited in sorted key order. {{range pipeline}} T1 {{else}} T0 {{end}} - The value of the pipeline must be an array, slice, map, or channel. + The value of the pipeline must be an array, slice, map, iter.Seq, + iter.Seq2 or channel. If the value of the pipeline has length zero, dot is unaffected and T0 is executed; otherwise, dot is set to the successive elements of the array, slice, or map and T1 is executed. |
