]> Cypherpunks repositories - gostls13.git/commit
text/template: add detailed info for goodFunc check
authorZxilly <zhouxinyu1001@gmail.com>
Tue, 12 Mar 2024 10:36:15 +0000 (10:36 +0000)
committerGopher Robot <gobot@golang.org>
Fri, 24 May 2024 21:22:24 +0000 (21:22 +0000)
commitc506f035d99153accf7a9b322c6596fc7652aea6
tree62f84af72b45c340a7102d5a5856692f45e12c46
parentb89f946c8814b3d984f06cd836c74ef95bc0b868
text/template: add detailed info for goodFunc check

goodFunc now returns a error describe the exact error it met.
builtin call function can print the name of the callee function
if the goodFunc check failed.

For input {{call .InvalidReturnCountFunc}}

before:
  can't evaluate field InvalidReturnTypeFunc in type *template.T
after:
  invalid function signature for .InvalidReturnTypeFunc: second argument should be error; is bool

Change-Id: I9aa53424ac9a2bffbdbeac889390f41218817575
GitHub-Last-Rev: 7c1e0dbd08884a38d92a42530104884a9ca52b44
GitHub-Pull-Request: golang/go#65509
Reviewed-on: https://go-review.googlesource.com/c/go/+/561115
Reviewed-by: Rob Pike <r@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
src/text/template/exec.go
src/text/template/exec_test.go
src/text/template/funcs.go