Skip to content

Commit

Permalink
Fix doc typo and add additional if condition
Browse files Browse the repository at this point in the history
Signed-off-by: Ankush Agarwal <[email protected]>
  • Loading branch information
ankushagarwal committed Dec 28, 2014
1 parent 8296502 commit 484f81e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions state/state.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package state

// State represents the state of a hosts
// State represents the state of a host
type State int

const (
Expand All @@ -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 ""
}

0 comments on commit 484f81e

Please sign in to comment.