You don't say what version of Go you are running, but as of Go 1.6,
templates can be redefined, which supports the new 'block' feature.

You are redefining a template, which used to be an error but is not any
more.

-rob


On Wed, Jun 22, 2016 at 1:13 PM, Evan Digby <evandi...@gmail.com> wrote:

> I'm noticing that if I accidentally create a second template with the same
> name but no content there is no error reported when I "parse" it, but then
> when I attempt to execute it I do see an error:
>
> https://play.golang.org/p/Rj3433vvju
>
> Is this expected behaviour? Why wouldn't it simply return an error from
> the Parse call?
>
> The key is the second template must have no content. The following does
> not return an error on execute:
>
> https://play.golang.org/p/O5xv5rS-cg (both have content)
> https://play.golang.org/p/kaoVWRunrP (only the second has content)
>
> I have also noticed that this isn't an issue if they are not all based
> from the same template:
>
> https://play.golang.org/p/iLoHokX4uy
> https://play.golang.org/p/T07Z9rvfmW
>
> The inconsistency in behaviour between the examples listed is a bit
> confusing. If there truly is expected that the one case that does error our
> on execute should error out, and not the others, I believe that the error
> makes more sense (and could be easily caught) on the Parse call, not the
> execute call.
>
> Can someone provide some insight into why this might legitimately be
> behaving this way?
>
> Thank you!
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to