From 89c9022dfec1b9d9aac5b57950ae93ba6f48685a Mon Sep 17 00:00:00 2001 From: Giovanni Harting <539@idlegandalf.com> Date: Fri, 14 Apr 2023 22:35:09 +0200 Subject: [PATCH] minor code cleanup --- ping-package.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ping-package.go b/ping-package.go index f7cace6..d6093fc 100644 --- a/ping-package.go +++ b/ping-package.go @@ -56,7 +56,7 @@ func formatLine(stats *probing.Statistics) { packetColor = "%{F#d60606}" } - fmt.Printf("%s%dms %%{F-}| %s%d%%\n", rttColor, stats.AvgRtt.Milliseconds(), packetColor, int(math.Round(stats.PacketLoss))) + fmt.Printf("%%{F-}\uE4E2 %s%dms %%{F-}\uF1B2 %s%d%%\n", rttColor, stats.AvgRtt.Milliseconds(), packetColor, int(math.Round(stats.PacketLoss))) } func formatLineWaybar(stats *probing.Statistics) { @@ -84,12 +84,10 @@ func main() { flag.Parse() for { - time.Sleep(time.Duration(*PingInterval) * time.Second) - pinger, err := probing.NewPinger(*Host) if err != nil { fmt.Println(err) - continue + goto sleep } pinger.Count = *PingCount if *Waybar { @@ -100,7 +98,9 @@ func main() { if pinger.Run() != nil { fmt.Println(err) - continue } + + sleep: + time.Sleep(time.Duration(*PingInterval) * time.Second) } }