From 5a5ef0364f7c5728a0a779ff12469944dac7d6b2 Mon Sep 17 00:00:00 2001 From: antklim Date: Fri, 30 Jul 2021 17:17:37 +1000 Subject: [PATCH] fix: fixed linter errors in client/service_manager --- client/service_manager.go | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/client/service_manager.go b/client/service_manager.go index dc338dc1b..7b46dafe9 100644 --- a/client/service_manager.go +++ b/client/service_manager.go @@ -35,12 +35,9 @@ func (s *ServiceManager) Setup() { // addServiceMonitor watches a channel to add services into operation. func (s *ServiceManager) addServiceMonitor() { log.Println("[DEBUG] starting service creation monitor") - for { - select { - case p := <-s.commandCreatedChan: - if p != nil && p.Process != nil { - s.processMap.Set(p.Process.Pid, p) - } + for p := range s.commandCreatedChan { + if p != nil && p.Process != nil { + s.processMap.Set(p.Process.Pid, p) } } } @@ -48,16 +45,12 @@ func (s *ServiceManager) addServiceMonitor() { // removeServiceMonitor watches a channel to remove services from operation. func (s *ServiceManager) removeServiceMonitor() { log.Println("[DEBUG] starting service removal monitor") - var p *exec.Cmd - for { - select { - case p = <-s.commandCompleteChan: - if p != nil && p.Process != nil { - if err := p.Process.Signal(os.Interrupt); err != nil { - log.Println("[ERROR] service removal monitor failed to process signal:", err) - } - s.processMap.Delete(p.Process.Pid) + for p := range s.commandCompleteChan { + if p != nil && p.Process != nil { + if err := p.Process.Signal(os.Interrupt); err != nil { + log.Println("[ERROR] service removal monitor failed to process signal:", err) } + s.processMap.Delete(p.Process.Pid) } } }