From 2c69fc3d4d910489c606f8e932c037f015182522 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 1 Jul 2025 10:35:39 +0200 Subject: [PATCH] pkg/compose: remove redundant uses of strslice.StrSlice The strslice.StrSlice type is a string-slice with a custom JSON Unmarshal function to provide backward-compatibility with older API requests (see [moby@17d6f00] and [moby@ea4a067]). Given that the type is assigned implicitly through the fields on HostConfig, we can just use a regular []string instead. [moby@17d6f00]: https://github.com/moby/moby/commit/17d6f00ec2b8b9636f0bb64c55a5b3855e8f4bae [moby@ea4a067]: https://github.com/moby/moby/commit/ea4a06740b6d4579f77507c1d7e0897a870fd72d Signed-off-by: Sebastiaan van Stijn --- pkg/compose/create.go | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/pkg/compose/create.go b/pkg/compose/create.go index 8e30c0220..e2fe3c6a6 100644 --- a/pkg/compose/create.go +++ b/pkg/compose/create.go @@ -36,7 +36,6 @@ import ( "github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/mount" "github.com/docker/docker/api/types/network" - "github.com/docker/docker/api/types/strslice" "github.com/docker/docker/api/types/versions" volumetypes "github.com/docker/docker/api/types/volume" "github.com/docker/go-connections/nat" @@ -181,15 +180,12 @@ func (s *composeService) getCreateConfigs(ctx context.Context, return createConfigs{}, err } - var ( - runCmd strslice.StrSlice - entrypoint strslice.StrSlice - ) + var runCmd, entrypoint []string if service.Command != nil { - runCmd = strslice.StrSlice(service.Command) + runCmd = service.Command } if service.Entrypoint != nil { - entrypoint = strslice.StrSlice(service.Entrypoint) + entrypoint = service.Entrypoint } var ( @@ -286,8 +282,8 @@ func (s *composeService) getCreateConfigs(ctx context.Context, Annotations: service.Annotations, Binds: binds, Mounts: mounts, - CapAdd: strslice.StrSlice(service.CapAdd), - CapDrop: strslice.StrSlice(service.CapDrop), + CapAdd: service.CapAdd, + CapDrop: service.CapDrop, NetworkMode: networkMode, Init: service.Init, IpcMode: container.IpcMode(service.Ipc),