From 5a9417f80ac1904544329b9738866ecae2121743 Mon Sep 17 00:00:00 2001 From: "Matt T. Proud" Date: Thu, 21 Mar 2013 11:52:42 +0100 Subject: [PATCH] Include humanized target state strings. In the current /status implementation, we cannot divine what the target's state is but rather get an integer constant for it. This commit, stringifies the constants. --- retrieval/target.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/retrieval/target.go b/retrieval/target.go index 695e7f59d..e1d448050 100644 --- a/retrieval/target.go +++ b/retrieval/target.go @@ -28,6 +28,19 @@ const ( // The state of the given Target. type TargetState int +func (t TargetState) String() string { + switch t { + case UNKNOWN: + return "UNKNOWN" + case ALIVE: + return "ALIVE" + case UNREACHABLE: + return "UNREACHABLE" + } + + panic("unknown state") +} + const ( // The Target has not been seen; we know nothing about it, except that it is // on our docket for examination.