From a2b81f13b05a24e3ed927cf9786c08c98e7d56b4 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 31 Aug 2021 13:27:12 +0300 Subject: [PATCH] [#746] morph/client: Simplify loop control in `iterateClients` Signed-off-by: Leonard Lyubich --- pkg/morph/client/multi.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pkg/morph/client/multi.go b/pkg/morph/client/multi.go index d38095c6..4b853656 100644 --- a/pkg/morph/client/multi.go +++ b/pkg/morph/client/multi.go @@ -90,14 +90,13 @@ func (x *multiClient) iterateClients(f func(*Client) error) error { err = f(c) } - success := err == nil + if err == nil { + return nil + } - if success || firstErr == nil { + // set first error once + if firstErr == nil { firstErr = err - - if success { - break - } } }