Skip to content

proposal: text/template: allow comments in operands #47581

@phenpessoa

Description

@phenpessoa

What version of Go are you using (go version)?

$ 1.16.7

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

N/A

What did you do?

Tried commenting operands.

{{$products := dict 
	"A" ( customslice
		/* Price */
		10
		/* Stock Amount */
		500
	)
}}
{{$products}}

What did you expect to see?

map[A:[10 500]]

What did you see instead?

unexpected "/" in operand

Playground:

https://play.golang.org/p/xDe9j18R3T5

-- Edit
A simpler example:

{{$x := 1 /* x variable */}}
{{$x}}

Playground:
https://play.golang.org/p/XK5h2JBD_8e

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions