-
Notifications
You must be signed in to change notification settings - Fork 44
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
Fix slice encoding #64
Conversation
Pull Request Test Coverage Report for Build 9752982979Details
💛 - Coveralls |
@chrisroberts Nice catch! Could you help me to add an integration test in You can take other cases as examples: gorm-cursor-paginator/cursor/encoding_test.go Lines 141 to 165 in 49dddd0
But I am wondering that |
Updates the util.ReflectValue function to not call Elem() on a reflect.Value that is a slice as it is only allowed on an interface or pointer and will panic otherwise.
49dddd0
to
d4ebce2
Compare
@pilagod Yeah, no problem. Added in the extra tests. As for the |
Pull Request Test Coverage Report for Build 9765782179Details
💛 - Coveralls |
You're right, I totally missed it is under another struct. Thank you so much for this patch, it looks pretty good to me. I will notify you once there is a new release including this fix 💪 |
I just released v2.6.1 to include this patch. Thanks again for the contribution. 🙌 |
Awesome, thank you so much @pilagod! |
Encoding a field that is a slice will currently panic due to
Elem()
being called on a slice inutil.ReflectValue
.reflect.Value
only allows forElem()
to be called on interface or pointer values and will panic otherwise. So this just removes slice from being included in the check to unwrap and adds in a test to validate that encoding the slice is successful.