diff --git a/state/state.go b/state/state.go index 655cb4f8c7..18f95e1507 100644 --- a/state/state.go +++ b/state/state.go @@ -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 "" }