fix: Cleanup

This commit is contained in:
Ilya Kuznetsov 2025-01-17 12:13:09 +01:00
parent 66dae816ab
commit d0db1d73f9
No known key found for this signature in database
GPG Key ID: 91F3DDCF5D21CDDF
1 changed files with 3 additions and 2 deletions

View File

@ -264,11 +264,12 @@ func (r *Root) InitializeVariables(vars []string) error {
// Variables can have any type of value, including complex types
func (r *Root) InitializeAnyTypeVariables(vars map[string]any) error {
for name, val := range vars {
if _, ok := r.Variables[name]; !ok {
variable, ok := r.Variables[name]
if !ok {
return fmt.Errorf("variable %s has not been defined", name)
}
err := r.Variables[name].Set(val)
err := variable.Set(val)
if err != nil {
return fmt.Errorf("failed to assign %s to %s: %s", val, name, err)
}