joao-r-reis commented on code in PR #1939:
URL: 
https://github.com/apache/cassandra-gocql-driver/pull/1939#discussion_r3017238705


##########
marshal.go:
##########
@@ -2923,9 +2923,13 @@ func (udt UDTTypeInfo) Marshal(value interface{}) 
([]byte, error) {
 func (udt UDTTypeInfo) Unmarshal(data []byte, value interface{}) error {
        // do this up here so we don't need to duplicate all of the map logic 
below
        if iptr, ok := value.(*interface{}); ok && iptr != nil {
-               v := map[string]interface{}{}
-               *iptr = v
+               var v map[string]interface{}
                value = &v
+               // Deffering this to the end of the method so dst var will hold 
updated map value
+               // 
https://issues.apache.org/jira/projects/CASSGO/issues/CASSGO-115
+               defer func() {
+                       *iptr = v
+               }()
        }

Review Comment:
   Hmm I think I'd rather just extract the code in `case 
*map[string]interface{}:` to a private method and add a `case *interface{}:` 
that calls this new method instead of doing this. It would be easier to read 
and less error prone imo



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to