From d7f28413b2e3dd2491b1405971253f0a08719a3e Mon Sep 17 00:00:00 2001 From: Anthony Axenov Date: Sat, 22 Nov 2025 19:27:33 +0800 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=BA=D0=BE=D1=80=D1=80=D0=B5=D0=BA?= =?UTF-8?q?=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=BE=20=D0=BF=D0=BE?= =?UTF-8?q?=D0=B2=D0=B5=D0=B4=D0=B5=D0=BD=D0=B8=D0=B5=20--repeat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit При значении 0 количество итераций будет бесконечным --- cmd/check.go | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/cmd/check.go b/cmd/check.go index 6698eb9..be9438a 100644 --- a/cmd/check.go +++ b/cmd/check.go @@ -35,13 +35,8 @@ var checkCmd = &cobra.Command{ } currentIteration := 1 - iterationCount := app.Args.RepeatCount - if iterationCount <= 0 { - iterationCount = 1 - } - for { - if app.Args.RepeatCount > 1 { + if app.Args.RepeatCount != 1 { log.Printf( "@ New iteration current=%d count=%d\n", currentIteration, @@ -65,11 +60,12 @@ var checkCmd = &cobra.Command{ fmt.Println(string(marshal)) } - if app.Args.RepeatCount <= 1 || uint(currentIteration) == app.Args.RepeatCount { - break + if app.Args.RepeatCount != 0 { + if uint(currentIteration) == app.Args.RepeatCount { + break + } + currentIteration++ } - - currentIteration++ log.Printf("Waiting for new iteration... seconds=%d\n", app.Args.RepeatEverySec) time.Sleep(time.Duration(app.Args.RepeatEverySec) * time.Second) }