]> Cypherpunks repositories - gostls13.git/commit
text/template: handle option missingkey=error consistently
authorÖzgür Kesim <oec-go@kesim.org>
Fri, 21 Oct 2016 11:14:57 +0000 (13:14 +0200)
committerRob Pike <r@golang.org>
Fri, 18 Nov 2016 15:56:02 +0000 (15:56 +0000)
commit277bcbbdcd26f2d64493e596238e34b47782f98e
tree862c5151f6c57bb3153ccd5d0d02c9576083a754
parent348275cda626edf60e1d11a83b2e78d83088ccef
text/template: handle option missingkey=error consistently

The existing implementation of text/template handles the option
"missingkey=error" in an inconsitent manner:  If the provided data is
a nil-interface, no error is returned (despite the fact that no key
can be found in it).

This patch makes text/template return an error if "missingkey=error"
is set and the provided data is a not a valid reflect.Value.

Fixes #15356

Change-Id: Ia0a83da48652ecfaf31f18bdbd78cb21dbca1164
Reviewed-on: https://go-review.googlesource.com/31638
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/text/template/exec.go
src/text/template/exec_test.go