Refactor: replace StringInSlice with slices.Contains

Signed-off-by: Oleksandr Redko <Oleksandr_Redko@epam.com>
This commit is contained in:
Oleksandr Redko
2024-01-05 14:48:12 +02:00
parent 82125f14b0
commit 8bdf77aa20
34 changed files with 79 additions and 133 deletions

View File

@ -47,6 +47,7 @@ import (
"github.com/opencontainers/runtime-tools/generate"
"github.com/opencontainers/selinux/go-selinux/label"
"github.com/sirupsen/logrus"
"golang.org/x/exp/slices"
"golang.org/x/sys/unix"
)
@ -1794,7 +1795,7 @@ func (c *Container) mountNamedVolume(v *ContainerNamedVolume, mountpoint string)
return nil, err
}
_, hasNoCopy := vol.config.Options["nocopy"]
if vol.state.NeedsCopyUp && !cutil.StringInSlice("nocopy", v.Options) && !hasNoCopy {
if vol.state.NeedsCopyUp && !slices.Contains(v.Options, "nocopy") && !hasNoCopy {
logrus.Debugf("Copying up contents from container %s to volume %s", c.ID(), vol.Name())
srcDir, err := securejoin.SecureJoin(mountpoint, v.Dest)