-
Notifications
You must be signed in to change notification settings - Fork 37
fix: max depth issues #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
| func isComplexValue(v reflect.Value) bool { | ||
| _, ok := complexBaseKind(v) | ||
| return ok | ||
| } | ||
|
|
||
| func complexBaseKind(v reflect.Value) (reflect.Kind, bool) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if quite no one use complex integers in Go it's a thing. So here, I feel like the wording could be different.
But I don't have better wording that "complicated" but it may sound strange too
1189729 to
07935f2
Compare
| for { | ||
| switch v.Kind() { | ||
| case reflect.Interface: | ||
| if v.IsNil() { | ||
| return 0, false | ||
| } | ||
| v = v.Elem() | ||
| case reflect.Ptr: | ||
| if v.IsNil() { | ||
| return 0, false | ||
| } | ||
| v = v.Elem() | ||
| default: | ||
| switch v.Kind() { | ||
| case reflect.Struct, reflect.Map, reflect.Slice, reflect.Array: | ||
| return v.Kind(), true | ||
| default: | ||
| return 0, false | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to do not do this ?
| for { | |
| switch v.Kind() { | |
| case reflect.Interface: | |
| if v.IsNil() { | |
| return 0, false | |
| } | |
| v = v.Elem() | |
| case reflect.Ptr: | |
| if v.IsNil() { | |
| return 0, false | |
| } | |
| v = v.Elem() | |
| default: | |
| switch v.Kind() { | |
| case reflect.Struct, reflect.Map, reflect.Slice, reflect.Array: | |
| return v.Kind(), true | |
| default: | |
| return 0, false | |
| } | |
| } | |
| } | |
| for { | |
| switch v.Kind() { | |
| case reflect.Interface: | |
| if v.IsNil() { | |
| return 0, false | |
| } | |
| v = v.Elem() | |
| case reflect.Ptr: | |
| if v.IsNil() { | |
| return 0, false | |
| } | |
| v = v.Elem() | |
| case reflect.Struct, reflect.Map, reflect.Slice, reflect.Array: | |
| return v.Kind(), true | |
| default: | |
| return 0, false | |
| } | |
| } |
Changes
Addresses #45