-
Notifications
You must be signed in to change notification settings - Fork 65
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
Slice of structs support #10
Conversation
Added slice of struct support, tag is not needed
Added slice of struct support, tag is not needed
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.
Thanks for your contribution!
Please make sure it passes CI.
defaults.go
Outdated
case reflect.Slice: | ||
for j := 0; j < field.Len(); j++ { | ||
sliceItem := field.Index(j) | ||
if sliceItem.Kind() != reflect.Struct { |
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.
Might want to call setField
recursively?
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.
Yes, definitely. Updated commit.
Oh, let me fix the CI. It seems to be outdated...
|
Meanwhile, could you add test cases? |
|
Not sure if it will break the existing test cases. But, either way, you'll need to edit it. |
Fixed here #11 |
Codecov Report
@@ Coverage Diff @@
## master #10 +/- ##
==========================================
- Coverage 100% 98.29% -1.71%
==========================================
Files 2 2
Lines 111 117 +6
==========================================
+ Hits 111 115 +4
- Misses 0 1 +1
- Partials 0 1 +1
Continue to review full report at Codecov.
|
Fine, I've implemented new test for this feature and ensured passage of the old ones. Please take a look. |
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.
Looking great!
Thanks 👍
Was glad to contribute. Thanks for your little handy lib, my utility's config really loved it! |
As for me, auto-iterating over slices of structs feels more like expected behaviour. Please review.
Original issue: #9