fix lint errors
Some checks failed
Lint / golangci-lint (push) Failing after 9m53s
Machine Tests / test (push) Successful in 40s

This commit is contained in:
Matthew Rich 2024-04-04 13:08:50 -07:00
parent 8b92e9e143
commit 85e39191b8
10 changed files with 180 additions and 181 deletions

View File

@ -38,7 +38,7 @@ func (d *Definition) AddTransition(trigger string, source State, dest State) {
func (d *Definition) GetState(name string) State { func (d *Definition) GetState(name string) State {
var r State var r State
for _,s := range(d.states) { for _, s := range d.states {
if string(s) == name { if string(s) == name {
return s return s
} }

View File

@ -3,9 +3,9 @@
package machine package machine
import ( import (
"github.com/stretchr/testify/assert"
"log" "log"
"testing" "testing"
"github.com/stretchr/testify/assert"
) )
func setupStater(initial State) Stater { func setupStater(initial State) Stater {

View File

@ -9,4 +9,3 @@ type mState struct {
func NewState(name string) *mState { func NewState(name string) *mState {
return &mState{name: name} return &mState{name: name}
} }

View File

@ -3,8 +3,8 @@
package machine package machine
import ( import (
_ "errors"
"fmt" "fmt"
"errors"
) )
type Transitioner interface { type Transitioner interface {
@ -33,7 +33,7 @@ func (r *Transition) Run(m Modeler) error {
return nil return nil
} }
} }
return errors.New(fmt.Sprintf("Transition from %s to %s failed on model state %s", r.source, r.dest, currentState)) return fmt.Errorf("Transition from %s to %s failed on model state %s", r.source, r.dest, currentState)
} }
func (r *Transition) Subscribe(s Subscriber) { func (r *Transition) Subscribe(s Subscriber) {

View File

@ -3,9 +3,9 @@
package machine package machine
import ( import (
"github.com/stretchr/testify/assert"
"log" "log"
"testing" "testing"
"github.com/stretchr/testify/assert"
) )
func setupTransition() Transitioner { func setupTransition() Transitioner {