From df7737ed577af65bd13e4ab64473879132a79139 Mon Sep 17 00:00:00 2001 From: Eng Zer Jun Date: Thu, 25 Apr 2024 06:13:03 +0800 Subject: [PATCH] errgroup: remove redundant `len` check (#2354) `len(g.children) > 0` is redundant because `range` already skips empty slice. Signed-off-by: Eng Zer Jun --- core/errgroup/errgroup.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/core/errgroup/errgroup.go b/core/errgroup/errgroup.go index ba8c4dc0..1f30cb19 100644 --- a/core/errgroup/errgroup.go +++ b/core/errgroup/errgroup.go @@ -330,11 +330,9 @@ func isNotNil(err error) bool { return true } - if len(g.children) > 0 { - for _, child := range g.children { - if isNotNil(child) { - return true - } + for _, child := range g.children { + if isNotNil(child) { + return true } }