Fix go-for-loop reference bug in template caching.

This commit is contained in:
Kailash Nadh 2022-10-21 17:59:56 +05:30
parent d2e8a9368c
commit 281c47198c

View file

@ -439,11 +439,12 @@ func initTxTemplates(m *manager.Manager, app *App) {
} }
for _, t := range tpls { for _, t := range tpls {
if err := t.Compile(app.manager.GenericTemplateFuncs()); err != nil { tpl := t
lo.Printf("error compiling transactional template %d: %v", t.ID, err) if err := tpl.Compile(app.manager.GenericTemplateFuncs()); err != nil {
lo.Printf("error compiling transactional template %d: %v", tpl.ID, err)
continue continue
} }
m.CacheTpl(t.ID, &t) m.CacheTpl(tpl.ID, &tpl)
} }
} }