You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
运行上诉的测试,Test_Once 可以拿到我自己设置的错误 invalid main.Level value~~~~ ,但是 Test_Nested 无法获取,只能获取 panic 的错误 gconv.Struct failed: reflect.Value.Convert: value of type map[string]interface {} cannot be converted to type tests.User 因为转换错误时,强制设置反射内容到 Hello.User 中导致 panic
Issues-translate-bot
changed the title
如何在 嵌套结构体中使用 gconv.Struct 转换失败后获取原始失败的 error ?
How to use gconv.Struct in a nested structure to obtain the original failed error after the conversion fails?
Apr 1, 2024
What do you want to ask
运行上诉的测试,
Test_Once
可以拿到我自己设置的错误invalid main.Level value~~~~
,但是Test_Nested
无法获取,只能获取 panic 的错误gconv.Struct failed: reflect.Value.Convert: value of type map[string]interface {} cannot be converted to type tests.User
因为转换错误时,强制设置反射内容到Hello.User
中导致 panicgf/util/gconv/gconv_struct.go
Line 599 in 509fdf4
The text was updated successfully, but these errors were encountered: