text/template: parsing and re-rendering a PipeNode replaces a range assignment with a declaration #65382
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Go version
go version go1.21.5 linux/amd64
Output of
go env
in your module/workspace:What did you do?
Given the following template:
after parsing the template, and write the String repl of the parsed tree using:
the result comes back as:
notice that the
range
changed fromassignment
todeclare
https://github.com/golang/go/blob/702d609a31f02007b471c072b633fa4238554022/src/text/template/parse/node.go#L220C1-L221C1
writeto should test whether it is assigment or declare
What did you see happen?
the assignment part of the range changed to declaration.
What did you expect to see?
the semantic is preserved during parse -> String roundtrip.
The text was updated successfully, but these errors were encountered: