I have these two structs:
type CustomTime struct {
time.Time
}
type Events struct {
Timestamp CustomTime
}
When I reflect
the field for Events.Timestamp
, I get CustomTime
; how can I get the actual underlying type which is time.Time
?
Here is a go playground example showing how you can access the anonymous field.
https://play.golang.org/p/yQULMVaQK0
Basically, once you have the value of the struct you should be able to get the Time value from field 0