From fa1b8d5d0c4ba2b2bd45fa4e0f92258beea25635 Mon Sep 17 00:00:00 2001 From: Lukas Elsner Date: Thu, 19 Dec 2019 12:57:50 -0500 Subject: [PATCH] proper set implementation --- internal/actions/update.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/internal/actions/update.go b/internal/actions/update.go index 4afa0f1..37fb22e 100644 --- a/internal/actions/update.go +++ b/internal/actions/update.go @@ -3,7 +3,6 @@ package actions import ( "github.com/containrrr/watchtower/internal/util" "github.com/containrrr/watchtower/pkg/container" - "github.com/deckarep/golang-set" log "github.com/sirupsen/logrus" ) @@ -74,18 +73,16 @@ func stopStaleContainer(container container.Container, client container.Client, } func restartContainersInSortedOrder(containers []container.Container, client container.Client, params UpdateParams) { - toDelete := mapset.NewSet() + toDelete := make(map[container.Container]bool) for _, container := range containers { if !container.Stale { continue } restartStaleContainer(container, client, params) - toDelete.Add(container) + toDelete[container] = true } if params.Cleanup { - iterator := toDelete.Iterator() - for c := range iterator.C { - cont := c.(container.Container) + for cont := range toDelete { if err := client.RemoveImage(cont); err != nil { log.Error(err) }