inline some conditionals

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2025-09-09 13:41:23 +02:00
parent 8631032556
commit 78e5a521b0
3 changed files with 4 additions and 10 deletions

View File

@ -131,8 +131,7 @@ func (c *Container) Commit(ctx context.Context, destImage string, options Contai
// Only include anonymous named volumes added by the user by
// default.
for _, v := range c.config.NamedVolumes {
include := slices.Contains(c.config.UserVolumes, v.Dest)
if include {
if slices.Contains(c.config.UserVolumes, v.Dest) {
vol, err := c.runtime.GetVolume(v.Name)
if err != nil {
return nil, fmt.Errorf("volume %s used in container %s has been removed: %w", v.Name, c.ID(), err)