diff --git a/helper/raftutil/msgpack.go b/helper/raftutil/msgpack.go index 1ee9d6cf6..f5663dd87 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 110cda684..f75488292 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 da3c41335..40356b001 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 }