-
-
Notifications
You must be signed in to change notification settings - Fork 274
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
use *bool as nullable boolean #127
Comments
This broke my team on the latest vendor after this change #120 before we could use a *bool to allow false to overwrite true. But with that change it no longer works. I'd like it if mergo can look at the pointer and see if the Elem().Kind() is a native type(not pointer or struct? or just int, bool etc.) and allow zero value to overwrite a non zero value. And make nil the value that doesn't merge. For now we are going to have to switch from *bool to *enum that has 'true', 'false', and a zero value 'invalid' |
Duplicate of #89 |
I don't think this is really a duplicate of #89, but a duplicate of #131 @JackQuincy sorry for the issue, you should be able to go back to merge bool pointers using |
proposal use *bool as nullable boolean
mergo will copy any not nil value to dst
index 3fb6c64..80e733b 100644
--- a/merge.go
+++ b/merge.go
@@ -170,6 +170,13 @@ func deepMerge(dst, src reflect.Value, visited map[uintptr]*visit, depth int, co
dst.Set(reflect.AppendSlice(dst, src))
}
case reflect.Ptr:
The text was updated successfully, but these errors were encountered: