From ee6abfd1bb99ff2406440af443ef798c9bc71f06 Mon Sep 17 00:00:00 2001 From: "Joel D. Elkins" Date: Mon, 15 Aug 2022 01:06:05 -0500 Subject: [PATCH] Make wasRunning a bool --- internal/pkg/container/container.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/pkg/container/container.go b/internal/pkg/container/container.go index d247bca..dc658c7 100644 --- a/internal/pkg/container/container.go +++ b/internal/pkg/container/container.go @@ -61,7 +61,7 @@ type Container struct { conn context.Context cdata *define.InspectContainerData - wasRunning null.Bool + wasRunning bool } func (c *Container) Init(conn context.Context, nets []network.Network) error { @@ -106,7 +106,7 @@ func (c *Container) Init(conn context.Context, nets []network.Network) error { } c.conn = conn err := c.populateCData() - c.wasRunning.SetValid(c.IsRunning()) + c.wasRunning = err != nil && c.IsRunning() return err } @@ -329,7 +329,7 @@ func (c *Container) UpdateCommands() cmd.CommandSet { func (c *Container) ConditionalStartCommands() cmd.CommandSet { return c.newCommandSet("CONDSTART", cmd.Commands{ cmd.NewConditional("restart_if_was_running", - c.wasRunning.ValueOrZero, + func() bool { return c.wasRunning }, cmd.NewSet(c.StartCommands()), cmd.NewNop(), ),