This repository has been archived by the owner on Dec 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Convert to using reflect.Value instead of Interface{} #8
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report
@@ Coverage Diff @@
## master #8 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 2 2
Lines 109 120 +11
=====================================
+ Hits 109 120 +11
|
1 similar comment
Codecov Report
@@ Coverage Diff @@
## master #8 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 2 2
Lines 109 120 +11
=====================================
+ Hits 109 120 +11
|
caledhwa
suggested changes
Jun 26, 2017
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.
A few small things (comments).
//make a copy here so if there is an error mid way, the target stays in tact | ||
cp := vT.Elem() | ||
|
||
//TODO reflect.Indirect(vS)? |
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.
TODO? Do you wanna get rid of this?
merge_test.go
Outdated
newMap, ok := merged.(map[string]interface{}) | ||
Expect(ok).To(BeTrue()) | ||
Expect(err).ToNot(HaveOccurred()) | ||
//newMap, ok := merged.(map[string]interface{}) |
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.
Commented code?
caledhwa
approved these changes
Jun 26, 2017
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
reflect.Value has more flexibility than an interface. Change how things work internally, so that is what gets passed around.
This also allows for generic merge functions of maps of any types.
Also switch to requiring the target passed as a pointer and setting its value instead of returning the merged item.