proper set implementation

pull/393/head
Lukas Elsner 5 years ago
parent a2a62fb46e
commit fa1b8d5d0c

@ -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)
}

Loading…
Cancel
Save