What version of Go are you using (go version)?
1.18.5
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env)?
GOARCH="arm64"
GOOS="darwin"
What did you do?
https://go.dev/play/p/nsZQiC5SVB6
What did you expect to see?
The builtins FuncMap should be applied when calling template.New()
What did you see instead?
panic: template: base:3: function "eq" not defined
In my program I would like to memoize parsed templates as parse.Tree objects so that they can be applied to templates later. An alternative approach would be to keep the instance of template.Template around but doing so maintains references to the functions that are passed to it, which is undesirable.
I propose that the builtins function map be applied to the template as soon as New is called and the internal init method executes.
I'm happy to contribute the change if this behavior is deemed unintended 😁