File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2424
2525package task
2626
27- type State string
27+ type State int
2828const (
29- STANDBY = State ("STANDBY" )
30- CONFIGURED = State ("CONFIGURED" )
31- RUNNING = State ("RUNNING" )
32- ERROR = State ("ERROR" )
33- DONE = State ("DONE" )
34- MIXED = State ("MIXED" )
29+ UNKNOWN State = iota
30+ STANDBY
31+ CONFIGURED
32+ RUNNING
33+ ERROR
34+ DONE
35+ MIXED
3536)
37+
38+ var _names = []string {
39+ "UNKNOWN" ,
40+ "STANDBY" ,
41+ "CONFIGURED" ,
42+ "RUNNING" ,
43+ "ERROR" ,
44+ "DONE" ,
45+ "MIXED" ,
46+ }
47+
3648func (s State ) String () string {
37- return string (s )
49+ if s > MIXED {
50+ return "UNKNOWN"
51+ }
52+ return _names [s ]
53+ }
54+
55+
56+ func StateFromString (s string ) State {
57+ for i , v := range _names {
58+ if s == v {
59+ return State (i )
60+ }
61+ }
62+ return UNKNOWN
3863}
3964
4065func (s State ) X (other State ) State {
You can’t perform that action at this time.
0 commit comments