text/template: integer literals wrapped in parens don't act as untyped constants #45134
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I ran this script: https://play.golang.org/p/0nprITNVbYP
What did you expect to see?
I expected to see
printed to standard output.
Per the
text/template
documentation on arguments:As such, I thought that passing
(1)
to the function would have had the same effect as passing1
- that is, both are interpreted as untyped constants and are accepted as arguments of type time.Duration. Furthermore, a similar program in Go not usingtext/template
works fine - given a functionf
that accepts one argument of type time.Duration,f(1)
andf((1))
both work correctly. See https://play.golang.org/p/f-BvvUqA9Y_o.What did you see instead?
I saw
printed to standard output, seemingly showing that
(1)
was not interpreted as an untyped constant while1
was.The text was updated successfully, but these errors were encountered: