Skip to content
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

Closed

Conversation

drenizg
Copy link

@drenizg drenizg commented Aug 25, 2022

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

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 {
Copy link

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() {
Copy link

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() {
Copy link

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.

@darccio
Copy link
Owner

darccio commented Sep 11, 2023

Codeclimate issues haven't been fixed, also no new features will be added to v1.

@darccio darccio closed this Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants