Skip to content

Commit

Permalink
Fix go-for-loop reference bug in template caching.
Browse files Browse the repository at this point in the history
  • Loading branch information
knadh committed Oct 21, 2022
1 parent d2e8a93 commit 281c471
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cmd/init.go
Expand Up @@ -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)
}
}

Expand Down

0 comments on commit 281c471

Please sign in to comment.