chore: fix tpl coderabbit suggestions

This commit is contained in:
jamesread 2026-02-07 00:31:24 +00:00
parent b777d599aa
commit 086a5ffd22
1 changed files with 6 additions and 3 deletions

View File

@ -12,7 +12,8 @@ import (
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
) )
var tpl = template.New("tpl") var tpl = template.New("tpl").
Option("missingkey=error")
type olivetinInfo struct { type olivetinInfo struct {
Build *installationinfo.BuildInfo Build *installationinfo.BuildInfo
@ -183,8 +184,6 @@ func parseTemplate(source string, data any) (string, error) {
return "", err return "", err
} }
t = t.Option("missingkey=error")
var sb strings.Builder var sb strings.Builder
err = t.Execute(&sb, data) err = t.Execute(&sb, data)
@ -203,6 +202,10 @@ func parseTemplate(source string, data any) (string, error) {
func ParseTemplateOfActionBeforeExec(source string, ent *entities.Entity) string { func ParseTemplateOfActionBeforeExec(source string, ent *entities.Entity) string {
result, err := ParseTemplateWithActionContext(source, ent, nil) result, err := ParseTemplateWithActionContext(source, ent, nil)
if err != nil { if err != nil {
log.WithFields(log.Fields{
"source": source,
"err": err,
}).Errorf("Error parsing template of action before exec")
return "" return ""
} }
return result return result