fix lint errors
This commit is contained in:
parent
8b92e9e143
commit
85e39191b8
@ -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
|
||||||
}
|
}
|
||||||
|
@ -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 {
|
||||||
|
1
state.go
1
state.go
@ -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}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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) {
|
||||||
|
@ -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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user