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
Add new WithSliceDeepMerge config option #222
Conversation
Added validations to some reflection calls that were causing panic: "reflect: call of reflect.Value.IsZero on zero Value"
@@ -231,6 +267,38 @@ func deepMerge(dst, src reflect.Value, visited map[uintptr]*visit, depth int, co | |||
return | |||
} | |||
} | |||
} else if sliceDeepMerge { |
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.
Avoid deeply nested control flow statements.
@@ -189,7 +193,39 @@ func deepMerge(dst, src reflect.Value, visited map[uintptr]*visit, depth int, co | |||
return | |||
} | |||
} | |||
} else if sliceDeepMerge { | |||
if srcSlice.Len() > dstSlice.Len() { |
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.
Similar blocks of code found in 2 locations. Consider refactoring.
@@ -231,6 +267,38 @@ func deepMerge(dst, src reflect.Value, visited map[uintptr]*visit, depth int, co | |||
return | |||
} | |||
} | |||
} else if sliceDeepMerge { | |||
if src.Len() > dst.Len() { |
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.
Similar blocks of code found in 2 locations. Consider refactoring.
Codeclimate issues haven't been fixed, also no new features will be added to v1. |
This PR aims to add a new feature to make it possible to deeply merge slices within maps by combining their contents.
Can be considered as a continuation of #180