Closed okhowang closed 2 years ago
exmaple code
package main import ( "fmt" "github.com/qmuntal/stateless" ) func main() { sm := stateless.NewStateMachine("a") sm.Configure("a").Permit("toB", "b") sm.Configure("b").InitialTransition("b-1") sm.Configure("b-1").SubstateOf("b").InitialTransition("b-1-1").Permit("toB2", "b-2") sm.Configure("b-2").SubstateOf("b") sm.Configure("b-1-1").SubstateOf("b-1") fmt.Println(sm.ToGraph()) }
which output
digraph { compound=true; node [shape=Mrecord]; rankdir="LR"; b-2 [label="b-2"]; b-1-1 [label="b-1-1"]; a [label="a"]; subgraph cluster_b { label="b"; b-1 [label="b-1"]; b-2 [label="b-2"]; } b-1 [label="b-1"]; a -> b [style="solid", label="toB"]; b-1 -> b-2 [style="solid", label="toB2"]; init [label="", shape=point]; init -> {a}[style = "solid"] }
Fixed in https://github.com/qmuntal/stateless/releases/tag/v1.5.3
exmaple code
which output