Skip to content

Commit

Permalink
Fix/Handle execution for no initial/entry step [#4]
Browse files Browse the repository at this point in the history
Merge pull request #4 from TanmoySG/fix-no-initial-step

In v0.1-beta if there are no steps (no initial or subsequent steps) then the Execute() functions panics and exits. To Fix this adding a simple check to see if (initial) steps are not empty. If it is then no error is returned or no panics are caused.

if len(steps) == 0 {
	return nil, nil
}
  • Loading branch information
TanmoySG authored Jul 10, 2023
2 parents df6e2fe + 43fbe77 commit 9624cf3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions go-steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ func (steps Steps) Execute(initArgs ...any) ([]interface{}, error) {
var stepOutput []interface{}
var stepError error

// no entry or initial step
if len(steps) == 0 {
return nil, nil
}

// entry step
var isEntryStep bool = true
step := steps[0]
Expand Down

0 comments on commit 9624cf3

Please sign in to comment.