]> Cypherpunks repositories - gostls13.git/commit
text/template: indirect interfaces before slicing
authorDaniel Martí <mvdan@mvdan.cc>
Wed, 18 Dec 2019 10:05:59 +0000 (10:05 +0000)
committerDaniel Martí <mvdan@mvdan.cc>
Thu, 19 Dec 2019 13:52:09 +0000 (13:52 +0000)
commit5481a97ab097ad27e9eeb9d10feeae22fd20e5ec
tree0ce759f34689baf98b4275d2be89d16a1b3f7663
parentba66797392da2b6538ce014a4f7e13c490e74d59
text/template: indirect interfaces before slicing

The recently added slice function used indirectInterface, but then
forgot to actually call reflect.Value.Slice on its result. Calling the
Slice method on the original Value without indirectInterface would
result in a panic, if our slice was indeed behind an interface.

Fix that, and add test cases for all three built-in functions that work
with slices.

Fixes #36199.

Change-Id: I9a18f4f604a3b29967eefeb573f8960000936b88
Reviewed-on: https://go-review.googlesource.com/c/go/+/211877
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
src/text/template/exec_test.go
src/text/template/funcs.go