You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@answer.apache.org by "Juneezee (via GitHub)" <gi...@apache.org> on 2023/11/04 11:14:15 UTC

[PR] refactor: remove redundant `len` and `nil` check [incubator-answer]

Juneezee opened a new pull request, #611:
URL: https://github.com/apache/incubator-answer/pull/611

   From the Go specification (https://go.dev/ref/spec#For_range):
   
   > "1. For a nil slice, the number of iterations is 0."
   
   `len` returns 0 if the slice is nil (https://pkg.go.dev/builtin#len). Therefore, checking `len(v) > 0` around a loop is unnecessary.
   
   Example Go playground: https://go.dev/play/p/s3FZcKC8ltm


-- 
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: commits-unsubscribe@answer.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] refactor: remove redundant `len` and `nil` check [incubator-answer]

Posted by "LinkinStars (via GitHub)" <gi...@apache.org>.
LinkinStars merged PR #611:
URL: https://github.com/apache/incubator-answer/pull/611


-- 
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: commits-unsubscribe@answer.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] refactor: remove redundant `len` and `nil` check [incubator-answer]

Posted by "LinkinStars (via GitHub)" <gi...@apache.org>.
LinkinStars commented on PR #611:
URL: https://github.com/apache/incubator-answer/pull/611#issuecomment-1793998679

   @Juneezee Thanks for the contribution, this PR will be merged in the next version.


-- 
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: commits-unsubscribe@answer.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org