Skip to content

Commit

Permalink
fixup init script expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
rangoo94 committed Mar 1, 2024
1 parent b2d13be commit 175fd82
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cmd/tcl/testworkflow-init/data/expressions.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ var RefSuccessMachine = expressionstcl.NewMachine().

var RefStatusMachine = expressionstcl.NewMachine().
RegisterAccessor(func(ref string) (interface{}, bool) {
return State.GetStep(ref).Status, true
return string(State.GetStep(ref).Status), true
})

var FileMachine = expressionstcl.NewMachine().
Expand Down
8 changes: 3 additions & 5 deletions pkg/tcl/expressionstcl/generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ func parseTag(tag string) tagData {
return tagData{value: s[0]}
}

var unrecognizedErr = errors.New("unsupported value passed for resolving expressions")

func clone(v reflect.Value) reflect.Value {
if v.Kind() == reflect.String {
s := v.String()
Expand Down Expand Up @@ -100,7 +98,7 @@ func resolve(v reflect.Value, t tagData, m []Machine, force bool) (changed bool,
}
return
case reflect.Slice:
if t.value == "" {
if t.value == "" && !force {
return changed, nil
}
for i := 0; i < v.Len(); i++ {
Expand Down Expand Up @@ -183,8 +181,8 @@ func resolve(v reflect.Value, t tagData, m []Machine, force bool) (changed bool,
return
}

// Fail for unrecognized values
return false, unrecognizedErr
// Ignore unrecognized values
return
}

func simplifyStruct(t interface{}, tag tagData, m ...Machine) error {
Expand Down

0 comments on commit 175fd82

Please sign in to comment.