String returns a short, lowercase human-readable name. Out-of-range or negative State values fall back to "state(N)" instead of panicking on the lookup array.
()
| 50 | // negative State values fall back to "state(N)" instead of panicking on |
| 51 | // the lookup array. |
| 52 | func (s State) String() string { |
| 53 | if s >= 0 && int(s) < len(stateNames) && stateNames[s] != "" { |
| 54 | return stateNames[s] |
| 55 | } |
| 56 | return fmt.Sprintf("state(%d)", s) |
| 57 | } |
| 58 | |
| 59 | // IsTerminal reports whether s requires external action (Start/Restart/Stop) |
| 60 | // to leave. |
no outgoing calls