Skip to content

Commit

Permalink
Signed-off-by: tooptoop4 <[email protected]>
Browse files Browse the repository at this point in the history
  • Loading branch information
tooptoop4 authored Oct 17, 2024
1 parent 415007c commit 90101cf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion util/template/expression_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,17 @@ func expressionReplace(w io.Writer, expression string, env map[string]interface{
// This allowUnresolved check is not great
// it allows for errors that are obviously
// not failed reference checks to also pass
if err != nil {
fmt.Println("failed to compile:", err)
}
if err != nil && !allowUnresolved {
return 0, fmt.Errorf("failed to evaluate expression: %w", err)
}
result, err := expr.Run(program, env)
if (err != nil || result == nil) && allowUnresolved {
// <nil> result is also un-resolved, and any error can be unresolved
log.WithError(err).Debug("Result and error are unresolved")
log.WithError(err).Infof("Result and error are unresolved: result=%v", result)
fmt.Println("", err)
return w.Write([]byte(fmt.Sprintf("{{%s%s}}", kindExpression, expression)))
}
if err != nil {
Expand Down

0 comments on commit 90101cf

Please sign in to comment.