diff options
| author | Jeroen Wijenbergh <jeroen.wijenbergh@geant.org> | 2025-05-06 12:40:47 +0200 |
|---|---|---|
| committer | Jeroen Wijenbergh <jeroen.wijenbergh@geant.org> | 2025-05-06 12:40:47 +0200 |
| commit | 347b20fc91505584bc9efbeca89590a411b95e79 (patch) | |
| tree | 9dfc600e957c4a881115f8bc8a9cc107a4f0cc9c /internal/fsm/fsm.go | |
| parent | 9c4985368aee638d982f30ea7bc5c7ee71ae3ab3 (diff) | |
All: Run modernize --test --fix
Diffstat (limited to 'internal/fsm/fsm.go')
| -rw-r--r-- | internal/fsm/fsm.go | 8 |
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 } |
