Commit c4fe9d50 by woodsaj

correctly handle event being a ptr

Events are passed in as PTRs, so we need to de-reference when getting the type and value.
parent 2c582852
......@@ -32,7 +32,7 @@ type EventBase interface {
}
func ToOnWriteEvent(event interface{}) (*OnTheWireEvent, error) {
eventType := reflect.TypeOf(event)
eventType := reflect.TypeOf(event).Elem()
wireEvent := OnTheWireEvent{
Priority: PRIO_INFO,
......@@ -40,7 +40,7 @@ func ToOnWriteEvent(event interface{}) (*OnTheWireEvent, error) {
Payload: event,
}
baseField := reflect.ValueOf(event).FieldByName("Timestamp")
baseField := reflect.Indirect(reflect.ValueOf(event)).FieldByName("Timestamp")
if baseField.IsValid() {
wireEvent.Timestamp = baseField.Interface().(time.Time)
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment