From 70206b7c2f1fbbd53db1d994907575607c956f4f Mon Sep 17 00:00:00 2001 From: "A.Unger" Date: Mon, 25 Jan 2021 15:53:13 +0100 Subject: [PATCH] fix staticcheck --- ocis/pkg/runtime/controller/util.go | 9 +++------ ocis/pkg/runtime/storage/map.go | 2 +- ocis/pkg/runtime/watcher/watcher.go | 10 ++++------ 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/ocis/pkg/runtime/controller/util.go b/ocis/pkg/runtime/controller/util.go index 5c0bee194..7e157cbfc 100644 --- a/ocis/pkg/runtime/controller/util.go +++ b/ocis/pkg/runtime/controller/util.go @@ -2,12 +2,9 @@ package controller // detach will try to restart processes on failures. func detach(c *Controller) { - for { - select { - case proc := <-c.Terminated: - if err := c.Start(proc); err != nil { - c.log.Err(err) - } + for proc := range c.Terminated { + if err := c.Start(proc); err != nil { + c.log.Err(err) } } } diff --git a/ocis/pkg/runtime/storage/map.go b/ocis/pkg/runtime/storage/map.go index 5f7db3c2b..9dfa59337 100644 --- a/ocis/pkg/runtime/storage/map.go +++ b/ocis/pkg/runtime/storage/map.go @@ -45,7 +45,7 @@ func (m *Map) Load(name string) int { // LoadAll values from the underlying data structure. func (m *Map) LoadAll() Entries { - e := make(map[string]int, 0) + e := make(map[string]int) m.c.Range(func(k, v interface{}) bool { ks, ok := k.(string) if !ok { diff --git a/ocis/pkg/runtime/watcher/watcher.go b/ocis/pkg/runtime/watcher/watcher.go index a819c1037..cbe2d46c7 100644 --- a/ocis/pkg/runtime/watcher/watcher.go +++ b/ocis/pkg/runtime/watcher/watcher.go @@ -36,12 +36,10 @@ func (w *Watcher) Follow(pe process.ProcEntry, followerChan chan process.ProcEnt }() go func() { - select { - case status := <-state: - w.log.Info().Str("package", "watcher").Msgf("%v exited with: %v", pe.Extension, status) - if restart { - followerChan <- pe - } + status := <-state + w.log.Info().Str("package", "watcher").Msgf("%v exited with: %v", pe.Extension, status) + if restart { + followerChan <- pe } }() }