From 7eaae97e374f1aa5242eca9b8772b776e72f3a43 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 16 May 2025 12:34:28 +0200 Subject: [PATCH] cli/command/container: use consistent alias for oci-spec Signed-off-by: Sebastiaan van Stijn --- cli/command/container/client_test.go | 6 +++--- cli/command/container/create.go | 4 ++-- cli/command/container/create_test.go | 10 +++++----- cli/command/container/run_test.go | 12 ++++++------ 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/cli/command/container/client_test.go b/cli/command/container/client_test.go index 61bf4c9ec8..369c845e21 100644 --- a/cli/command/container/client_test.go +++ b/cli/command/container/client_test.go @@ -11,7 +11,7 @@ import ( "github.com/docker/docker/api/types/network" "github.com/docker/docker/api/types/system" "github.com/docker/docker/client" - specs "github.com/opencontainers/image-spec/specs-go/v1" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" ) type fakeClient struct { @@ -22,7 +22,7 @@ type fakeClient struct { createContainerFunc func(config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, - platform *specs.Platform, + platform *ocispec.Platform, containerName string) (container.CreateResponse, error) containerStartFunc func(containerID string, options container.StartOptions) error imageCreateFunc func(ctx context.Context, parentReference string, options image.CreateOptions) (io.ReadCloser, error) @@ -84,7 +84,7 @@ func (f *fakeClient) ContainerCreate( config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, - platform *specs.Platform, + platform *ocispec.Platform, containerName string, ) (container.CreateResponse, error) { if f.createContainerFunc != nil { diff --git a/cli/command/container/create.go b/cli/command/container/create.go index 8993ffce5c..54e73c9264 100644 --- a/cli/command/container/create.go +++ b/cli/command/container/create.go @@ -29,7 +29,7 @@ import ( "github.com/docker/docker/api/types/versions" "github.com/docker/docker/client" "github.com/docker/docker/errdefs" - specs "github.com/opencontainers/image-spec/specs-go/v1" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" "github.com/spf13/cobra" "github.com/spf13/pflag" @@ -308,7 +308,7 @@ func createContainer(ctx context.Context, dockerCli command.Cli, containerCfg *c } } - var platform *specs.Platform + var platform *ocispec.Platform // Engine API version 1.41 first introduced the option to specify platform on // create. It will produce an error if you try to set a platform on older API // versions, so check the API version here to maintain backwards diff --git a/cli/command/container/create_test.go b/cli/command/container/create_test.go index cb2251ac84..fd94b624c8 100644 --- a/cli/command/container/create_test.go +++ b/cli/command/container/create_test.go @@ -19,7 +19,7 @@ import ( "github.com/docker/docker/api/types/network" "github.com/docker/docker/api/types/system" "github.com/google/go-cmp/cmp" - specs "github.com/opencontainers/image-spec/specs-go/v1" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" "github.com/spf13/pflag" "gotest.tools/v3/assert" is "gotest.tools/v3/assert/cmp" @@ -121,7 +121,7 @@ func TestCreateContainerImagePullPolicy(t *testing.T) { config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, - platform *specs.Platform, + platform *ocispec.Platform, containerName string, ) (container.CreateResponse, error) { defer func() { tc.ResponseCounter++ }() @@ -253,7 +253,7 @@ func TestNewCreateCommandWithContentTrustErrors(t *testing.T) { createContainerFunc: func(config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, - platform *specs.Platform, + platform *ocispec.Platform, containerName string, ) (container.CreateResponse, error) { return container.CreateResponse{}, errors.New("shouldn't try to pull image") @@ -308,7 +308,7 @@ func TestNewCreateCommandWithWarnings(t *testing.T) { createContainerFunc: func(config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, - platform *specs.Platform, + platform *ocispec.Platform, containerName string, ) (container.CreateResponse, error) { return container.CreateResponse{Warnings: tc.warnings}, nil @@ -347,7 +347,7 @@ func TestCreateContainerWithProxyConfig(t *testing.T) { createContainerFunc: func(config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, - platform *specs.Platform, + platform *ocispec.Platform, containerName string, ) (container.CreateResponse, error) { sort.Strings(config.Env) diff --git a/cli/command/container/run_test.go b/cli/command/container/run_test.go index bf48d3066d..f60ebde360 100644 --- a/cli/command/container/run_test.go +++ b/cli/command/container/run_test.go @@ -21,7 +21,7 @@ import ( "github.com/docker/docker/api/types/image" "github.com/docker/docker/api/types/network" "github.com/docker/docker/pkg/jsonmessage" - specs "github.com/opencontainers/image-spec/specs-go/v1" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" "github.com/spf13/pflag" "gotest.tools/v3/assert" is "gotest.tools/v3/assert/cmp" @@ -57,7 +57,7 @@ func TestRunValidateFlags(t *testing.T) { func TestRunLabel(t *testing.T) { fakeCLI := test.NewFakeCli(&fakeClient{ - createContainerFunc: func(_ *container.Config, _ *container.HostConfig, _ *network.NetworkingConfig, _ *specs.Platform, _ string) (container.CreateResponse, error) { + createContainerFunc: func(_ *container.Config, _ *container.HostConfig, _ *network.NetworkingConfig, _ *ocispec.Platform, _ string) (container.CreateResponse, error) { return container.CreateResponse{ ID: "id", }, nil @@ -80,7 +80,7 @@ func TestRunAttach(t *testing.T) { var conn net.Conn attachCh := make(chan struct{}) fakeCLI := test.NewFakeCli(&fakeClient{ - createContainerFunc: func(_ *container.Config, _ *container.HostConfig, _ *network.NetworkingConfig, _ *specs.Platform, _ string) (container.CreateResponse, error) { + createContainerFunc: func(_ *container.Config, _ *container.HostConfig, _ *network.NetworkingConfig, _ *ocispec.Platform, _ string) (container.CreateResponse, error) { return container.CreateResponse{ ID: "id", }, nil @@ -151,7 +151,7 @@ func TestRunAttachTermination(t *testing.T) { killCh := make(chan struct{}) attachCh := make(chan struct{}) fakeCLI := test.NewFakeCli(&fakeClient{ - createContainerFunc: func(_ *container.Config, _ *container.HostConfig, _ *network.NetworkingConfig, _ *specs.Platform, _ string) (container.CreateResponse, error) { + createContainerFunc: func(_ *container.Config, _ *container.HostConfig, _ *network.NetworkingConfig, _ *ocispec.Platform, _ string) (container.CreateResponse, error) { return container.CreateResponse{ ID: "id", }, nil @@ -229,7 +229,7 @@ func TestRunPullTermination(t *testing.T) { attachCh := make(chan struct{}) fakeCLI := test.NewFakeCli(&fakeClient{ createContainerFunc: func(config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, - platform *specs.Platform, containerName string, + platform *ocispec.Platform, containerName string, ) (container.CreateResponse, error) { return container.CreateResponse{}, errors.New("shouldn't try to create a container") }, @@ -332,7 +332,7 @@ func TestRunCommandWithContentTrustErrors(t *testing.T) { createContainerFunc: func(config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, - platform *specs.Platform, + platform *ocispec.Platform, containerName string, ) (container.CreateResponse, error) { return container.CreateResponse{}, errors.New("shouldn't try to pull image")