Skip to content

text/template: not able to redefine template as an empty string #16156

@evandigby

Description

@evandigby

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?
  • go version go1.6 linux/amd64
  • go version go1.6 darwin/amd64
  • go playground
  1. What operating system and processor architecture are you using (go env)?
  • darwin/amd64
  • linux/amd64
  • go playground
  1. What did you do?

Attempt to redefine a text/template as an empty string using parse, and then executed the template:
https://play.golang.org/p/gotXx8qF3e

  1. What did you expect to see?

I expected the template to successfully execute and produce an empty string.

Alternatively, if it is expected behaviour to not allow redefining as an empty string, I expect an error to be returned on the "Parse" call.

  1. What did you see instead?

The execute function returned the following error:
template: test: "test" is an incomplete or empty template; defined templates are: "test"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions