From ef599aa8fc9faf2747d3ec9fb02fb7b80af27cc6 Mon Sep 17 00:00:00 2001 From: Moritz Poldrack Date: Fri, 29 Jul 2022 21:42:02 +0200 Subject: lint: simplify code (gosimple) Replaces infinite for loops containing a select on a channel with a single case with a range over the channel. Removes redundant assignments to blank identifiers. Remove unnecessary guard clause around delete(). Remove `if condition { return true } return false` with return condition Signed-off-by: Moritz Poldrack Acked-by: Robin Jarry --- worker/imap/idler.go | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) (limited to 'worker/imap') diff --git a/worker/imap/idler.go b/worker/imap/idler.go index 055bab8b..69fdc4ca 100644 --- a/worker/imap/idler.go +++ b/worker/imap/idler.go @@ -134,23 +134,20 @@ func (i *idler) waitOnIdle() { i.log("wait for idle in background") go func() { defer logging.PanicHandler() - select { - case err := <-i.done: - if err == nil { - i.log("<=(idle) waited") - i.log("connect done->") - i.worker.PostMessage(&types.Done{ - Message: types.RespondTo(&types.Connect{}), - }, nil) - } else { - i.log("<=(idle) waited; with err: %v", err) - } - i.setWaiting(false) - i.stop = make(chan struct{}) - i.log("restart") - i.Start() - return + err := <-i.done + if err == nil { + i.log("<=(idle) waited") + i.log("connect done->") + i.worker.PostMessage(&types.Done{ + Message: types.RespondTo(&types.Connect{}), + }, nil) + } else { + i.log("<=(idle) waited; with err: %v", err) } + i.setWaiting(false) + i.stop = make(chan struct{}) + i.log("restart") + i.Start() }() } -- cgit