chengxilo commented on code in PR #1904:
URL: https://github.com/apache/iggy/pull/1904#discussion_r2164081478


##########
foreign/go/benchmarks/send_messages_benchmark_test.go:
##########
@@ -148,7 +148,11 @@ func CreateMessages(messagesCount, messageSize int) 
[]iggcon.IggyMessage {
                }
                id, _ := uuid.NewUUID()
 
-               messages[i] = iggcon.NewIggyMessage(id, payload)
+               var err error

Review Comment:
   Declaring err inside the loop is not only perfectly valid but often 
preferred. It limits the variable’s scope to where it's actually used. I also 
don't think it would affect the effieciency of the code since when we create an 
error with `var err error` it will just create a nil. In my opinion it is 
totally fine.
   Or could you please provide some more precise reason to tell me why we 
should initialize the err out of the scope?



##########
foreign/go/benchmarks/send_messages_benchmark_test.go:
##########
@@ -148,7 +148,11 @@ func CreateMessages(messagesCount, messageSize int) 
[]iggcon.IggyMessage {
                }
                id, _ := uuid.NewUUID()
 
-               messages[i] = iggcon.NewIggyMessage(id, payload)
+               var err error

Review Comment:
   Declaring err inside the loop is not only perfectly valid but often 
preferred. It limits the variable’s scope to where it's actually used. I also 
don't think it would affect the effieciency of the code since when we create an 
error with `var err error` it will just create a nil. In my opinion it is 
totally fine.
   Could you please provide some more precise reason to tell me why we should 
initialize the err out of the scope?



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

Reply via email to