From 281c47198cf31ea004af44dff4989413fe26dd04 Mon Sep 17 00:00:00 2001 From: Kailash Nadh Date: Fri, 21 Oct 2022 17:59:56 +0530 Subject: [PATCH] Fix go-for-loop reference bug in template caching. --- cmd/init.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/init.go b/cmd/init.go index d00f026..4b0caf4 100644 --- a/cmd/init.go +++ b/cmd/init.go @@ -439,11 +439,12 @@ func initTxTemplates(m *manager.Manager, app *App) { } for _, t := range tpls { - if err := t.Compile(app.manager.GenericTemplateFuncs()); err != nil { - lo.Printf("error compiling transactional template %d: %v", t.ID, err) + tpl := t + if err := tpl.Compile(app.manager.GenericTemplateFuncs()); err != nil { + lo.Printf("error compiling transactional template %d: %v", tpl.ID, err) continue } - m.CacheTpl(t.ID, &t) + m.CacheTpl(tpl.ID, &tpl) } }