]> Cypherpunks repositories - gostls13.git/commit
text/template: Make function call builtin handle nil errors correctly
authorElias Naur <elias.naur@gmail.com>
Tue, 13 Aug 2013 01:11:05 +0000 (11:11 +1000)
committerRob Pike <r@golang.org>
Tue, 13 Aug 2013 01:11:05 +0000 (11:11 +1000)
commit83348a13fb40ac80e2587e27c29d18360177f3b1
tree6befa131ede7d67b3f9e2c106cd914444a669ec7
parent9a0a59f171d0ae1defff35440c93e1a119289c29
text/template: Make function call builtin handle nil errors correctly

The call builtin unconditionally tries to convert a second return value from a function to the error type. This fails in case nil is returned, effectively making call useless for functions returning two values.

This CL adds a nil check for the second return value, and adds a test.

Note that for regular function and method calls the nil error case is handled correctly and is verified by a test.

R=r
CC=golang-dev
https://golang.org/cl/12804043
src/pkg/text/template/exec_test.go
src/pkg/text/template/funcs.go