This repository has been archived by the owner on Jul 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 679
The time.Time type is converted to empty map #334
Comments
could |
3 tasks
Same problem |
converting time to time also doesn't work for me, I have this failing test to demonstrate func TestDecoder_timeStructs(t *testing.T) {
type Input struct {
TheTime time.Time
}
timeNow := time.Now()
input := &Input{
TheTime: timeNow,
}
type Output struct {
TheTime time.Time
}
actual := &Output{}
config := &DecoderConfig{
Result: &actual,
IgnoreUntaggedFields: true,
}
decoder, err := NewDecoder(config)
if err != nil {
t.Fatalf("err: %s", err)
}
err = decoder.Decode(input)
if err != nil {
t.Fatalf("err: %s", err)
}
expected := Output{
TheTime: timeNow,
}
if !reflect.DeepEqual(expected, actual) {
t.Fatalf("Decode() expected: %#v\ngot: %#v", expected, actual)
}
}
|
It also doesn't work for me; I hope it will soon support this case. |
I am also running into this with a function for a project I'm working on. Maybe this will be handled in |
I'm experiencing the same issue. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
type Person struct {
Name string
json:"name"
Age int
json:"age"
Time time.Time
json:"time"
Address Address
json:"address"
}
Why a time.Time type has to be converted to map, not recursive transfer is not on the line, configuration is not, read a lot of posts, what hook, hook function is not good. I recommend using the github.com/fatih/structs library, I really buy it
The text was updated successfully, but these errors were encountered: