Skip to content

Commit

Permalink
removing step name as parameter to addStep
Browse files Browse the repository at this point in the history
  • Loading branch information
Gilbert Mena committed Feb 28, 2024
1 parent b219cd0 commit 1cecb75
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions examples/backward/backward_example.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,10 @@ func main() {
})
primero := &Step1{}
step1 := statemachine.NewStep(primero.Name(), zap.NewNop(), primero.ExecuteForward, primero.ExecuteBackward, primero.ExecutePause, primero.ExecuteResume)
sm.AddStep(step1, primero.Name())
sm.AddStep(step1)
segundo := &Step2{}
step2 := statemachine.NewStep(segundo.Name(), zap.NewNop(), segundo.ExecuteForward, segundo.ExecuteBackward, segundo.ExecutePause, segundo.ExecuteResume)
sm.AddStep(step2, segundo.Name())
sm.AddStep(step2)

err = sm.Run()
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions examples/backward/retry/retry_example.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,10 @@ func main() {
})
step1Handler := &Step1{}
step1 := statemachine.NewStep(step1Handler.Name(), zap.NewNop(), step1Handler.ExecuteForward, step1Handler.ExecuteBackward, step1Handler.ExecutePause, step1Handler.ExecuteResume)
sm.AddStep(step1, step1.Name())
sm.AddStep(step1)
step2Handler := &Step2{}
step2 := statemachine.NewStep(step2Handler.Name(), zap.NewNop(), step2Handler.ExecuteForward, step2Handler.ExecuteBackward, step2Handler.ExecutePause, step2Handler.ExecuteResume)
sm.AddStep(step2, step2.Name())
sm.AddStep(step2)

err = sm.Run()
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions examples/forward/forward_example.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,11 @@ func main() {
})
step1Handler := &Step1{}
step1 := statemachine.NewStep(step1Handler.Name(), zap.NewNop(), step1Handler.ExecuteForward, step1Handler.ExecuteBackward, step1Handler.ExecutePause, step1Handler.ExecuteResume)
sm.AddStep(step1, step1Handler.Name())
sm.AddStep(step1)
step2Handler := &Step2{}
//sm.AddStep(step2Handler, step2Handler.Name())
//sm.AddStep(step2Handler)
step2 := statemachine.NewStep(step2Handler.Name(), zap.NewNop(), step2Handler.ExecuteForward, step2Handler.ExecuteBackward, step2Handler.ExecutePause, step2Handler.ExecuteResume)
sm.AddStep(step2, step2Handler.Name())
sm.AddStep(step2)
//cancel()
err = sm.Run()
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions examples/forward/retry/retry_example.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ func main() {
})
step1Handler := &Step1{}
step1 := statemachine.NewStep(step1Handler.Name(), zap.NewNop(), step1Handler.ExecuteForward, step1Handler.ExecuteBackward, step1Handler.ExecutePause, step1Handler.ExecuteResume)
sm.AddStep(step1, step1Handler.Name())
sm.AddStep(step1)
step2Handler := &Step2{}
step2 := statemachine.NewStep(step2Handler.Name(), zap.NewNop(), step2Handler.ExecuteForward, step2Handler.ExecuteBackward, step2Handler.ExecutePause, step2Handler.ExecuteResume)
sm.AddStep(step2, step2.Name())
sm.AddStep(step2)

err = sm.Run()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion statemachine.go
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ func (sm *StateMachine) SetState(newState State, event Event) error {
}

// AddStep adds a handler to the state machine.
func (sm *StateMachine) AddStep(handler StepHandler, name string) *StateMachine {
func (sm *StateMachine) AddStep(handler StepHandler) *StateMachine {
sm.Handlers = append(sm.Handlers, handler)
return sm
}
Expand Down

0 comments on commit 1cecb75

Please sign in to comment.