From 75577fe7a8d9f21442b00df90c8ac33ebea2ac67 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 20 Jul 2022 15:14:04 +0200 Subject: [PATCH] logger/journald: fix SA4011: ineffective break statement This was introduced in 906b979b888cf9111a4a2583640e509d28395670, which changed a `goto` to a `break`, but afaics, the intent was still to break out of the loop. (linter didn't catch this before because it didn't have the right build-tag set) daemon/logger/journald/read.go:238:4: SA4011: ineffective break statement. Did you mean to break out of the outer loop? (staticcheck) break // won't be able to write anything anymore ^ Signed-off-by: Sebastiaan van Stijn --- daemon/logger/journald/read.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/daemon/logger/journald/read.go b/daemon/logger/journald/read.go index eb299e2c5e..c909509e3b 100644 --- a/daemon/logger/journald/read.go +++ b/daemon/logger/journald/read.go @@ -227,6 +227,7 @@ func (s *journald) followJournal(logWatcher *logger.LogWatcher, j *C.sd_journal, waitTimeout := C.uint64_t(250000) // 0.25s +LOOP: for { status := C.sd_journal_wait(j, waitTimeout) if status < 0 { @@ -235,7 +236,7 @@ func (s *journald) followJournal(logWatcher *logger.LogWatcher, j *C.sd_journal, } select { case <-logWatcher.WatchConsumerGone(): - break // won't be able to write anything anymore + break LOOP // won't be able to write anything anymore case <-s.closed: // container is gone, drain journal default: