summaryrefslogtreecommitdiff
path: root/internal/fsm/fsm.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/fsm/fsm.go')
-rw-r--r--internal/fsm/fsm.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/fsm/fsm.go b/internal/fsm/fsm.go
index 5985aa5..c3b9255 100644
--- a/internal/fsm/fsm.go
+++ b/internal/fsm/fsm.go
@@ -54,7 +54,7 @@ type FSM struct {
// StateCallback is the function ran when a transition occurs
// It takes the old state, the new state and the data and returns if this is handled by the client
- StateCallback func(StateID, StateID, interface{}) bool
+ StateCallback func(StateID, StateID, any) bool
// GetStateName gets the name of a state as a string
GetStateName func(StateID) string
@@ -64,7 +64,7 @@ type FSM struct {
}
// NewFSM creates a new finite state machine
-func NewFSM(current StateID, states States, callback func(StateID, StateID, interface{}) bool, nameGen func(StateID) string) FSM {
+func NewFSM(current StateID, states States, callback func(StateID, StateID, any) bool, nameGen func(StateID) string) FSM {
return FSM{
States: states,
Current: current,
@@ -97,7 +97,7 @@ func (fsm *FSM) CheckTransition(desired StateID) error {
// GoTransitionRequired transitions the state machine to a new state with associated state data 'data'
// If this transition is not handled by the client, it returns an error.
-func (fsm *FSM) GoTransitionRequired(newState StateID, data interface{}) error {
+func (fsm *FSM) GoTransitionRequired(newState StateID, data any) error {
oldState := fsm.Current
handled, err := fsm.GoTransitionWithData(newState, data)
@@ -114,7 +114,7 @@ func (fsm *FSM) GoTransitionRequired(newState StateID, data interface{}) error {
// GoTransitionWithData is a helper that transitions the state machine toward the 'newState' with associated state data 'data'
// It returns whether or not the transition is handled by the client.
-func (fsm *FSM) GoTransitionWithData(newState StateID, data interface{}) (bool, error) {
+func (fsm *FSM) GoTransitionWithData(newState StateID, data any) (bool, error) {
if err := fsm.CheckTransition(newState); err != nil {
return false, err
}