Tsukikage7 commented on code in PR #3154:
URL: https://github.com/apache/dubbo-go/pull/3154#discussion_r2692933818


##########
server/server.go:
##########
@@ -176,6 +179,61 @@ func (s *Server) genSvcOpts(handler any, info 
*common.ServiceInfo, opts ...Servi
        return newSvcOpts, nil
 }
 
+// isNillable checks if a reflect.Value's kind supports nil checking.
+func isNillable(v reflect.Value) bool {
+       switch v.Kind() {
+       case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, 
reflect.Pointer, reflect.Slice:
+               return true
+       default:
+               return false
+       }
+}
+
+// isReflectNil safely checks if a reflect.Value is nil.
+func isReflectNil(v reflect.Value) bool {
+       return isNillable(v) && v.IsNil()
+}

Review Comment:
   Good catch. They do look similar but live in different packages:
   
   server/server.go has CallMethodByReflection (exported, shared)
   protocol/triple/server.go has isReflectValueNil (local helper)
   Thought about extracting a common util, but protocol/triple importing server 
package might cause circular deps. It's just a few lines so I think we're fine 
for now. Happy to refactor if you think it's worth it.



-- 
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