mirror of https://github.com/docker/docs.git
Fix doc typo and add additional if condition
Signed-off-by: Ankush Agarwal <ankushagarwal11@gmail.com>
This commit is contained in:
parent
82965024ea
commit
484f81e1ce
|
@ -1,6 +1,6 @@
|
|||
package state
|
||||
|
||||
// State represents the state of a hosts
|
||||
// State represents the state of a host
|
||||
type State int
|
||||
|
||||
const (
|
||||
|
@ -25,9 +25,11 @@ var states = []string{
|
|||
"Error",
|
||||
}
|
||||
|
||||
// Given a State type, returns its string representation
|
||||
func (s State) String() string {
|
||||
if int(s) < len(states) {
|
||||
if int(s) >= 0 && int(s) < len(states) {
|
||||
return states[s]
|
||||
} else {
|
||||
return ""
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue