diff --git a/helper/raftutil/msgpack.go b/helper/raftutil/msgpack.go index f5663dd87..1ee9d6cf6 100644 --- a/helper/raftutil/msgpack.go +++ b/helper/raftutil/msgpack.go @@ -10,8 +10,8 @@ import ( "github.com/hashicorp/nomad/nomad/structs" ) -// fixTime converts any suspected time.Time binary string representation to time.Time -func fixTime(v interface{}) { +// FixTime converts any suspected time.Time binary string representation to time.Time +func FixTime(v interface{}) { switch v2 := v.(type) { case map[string]interface{}: for ek, ev := range v2 { @@ -21,12 +21,12 @@ func fixTime(v interface{}) { v2[ek] = *t } } else { - fixTime(ev) + FixTime(ev) } } case []interface{}: for _, e := range v2 { - fixTime(e) + FixTime(e) } default: return diff --git a/helper/raftutil/msgpack_test.go b/helper/raftutil/msgpack_test.go index f75488292..110cda684 100644 --- a/helper/raftutil/msgpack_test.go +++ b/helper/raftutil/msgpack_test.go @@ -49,7 +49,7 @@ func TestDecodesTime(t *testing.T) { require.Equal(t, "host", r["Mode"]) require.IsType(t, "", r["CreateTime"]) - fixTime(r) + FixTime(r) expected := map[string]interface{}{ "CreateTime": now, diff --git a/helper/raftutil/state.go b/helper/raftutil/state.go index 7b155b799..21b0b9be4 100644 --- a/helper/raftutil/state.go +++ b/helper/raftutil/state.go @@ -117,7 +117,7 @@ func decode(e *raft.Log) (*logMessage, error) { fmt.Fprintf(os.Stderr, "failed to decode log entry at index %d: failed to decode body of %v.%v %v\n", e.Index, e.Type, m.CommandType, err) v = "FAILED TO DECODE DATA" } - fixTime(v) + FixTime(v) m.Body = v }