Преглед изворни кода

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 <github@gone.nl>
Sebastiaan van Stijn пре 3 година
родитељ
комит
75577fe7a8
1 измењених фајлова са 2 додато и 1 уклоњено
  1. 2 1
      daemon/logger/journald/read.go

+ 2 - 1
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: