mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
client: fix missing import aliases (importas)
client/container_exec.go:8:2: import "github.com/containerd/errdefs" imported without alias but must be with alias "cerrdefs" according to config (importas)
"github.com/containerd/errdefs"
^
client/container_exec_test.go:9:2: import "github.com/containerd/errdefs" imported without alias but must be with alias "cerrdefs" according to config (importas)
"github.com/containerd/errdefs"
^
client/container_rename.go:8:2: import "github.com/containerd/errdefs" imported without alias but must be with alias "cerrdefs" according to config (importas)
"github.com/containerd/errdefs"
^
client/pkg/security/security_opts_test.go:8:2: import "gotest.tools/v3/assert/cmp" imported without alias but must be with alias "is" according to config (importas)
"gotest.tools/v3/assert/cmp"
^
client/volume_prune.go:9:2: import "github.com/containerd/errdefs" imported without alias but must be with alias "cerrdefs" according to config (importas)
"github.com/containerd/errdefs"
^
client/volume_prune_test.go:8:2: import "github.com/containerd/errdefs" imported without alias but must be with alias "cerrdefs" according to config (importas)
"github.com/containerd/errdefs"
^
client/container_exec_test.go:10:2: ST1019(related information): other import of "github.com/containerd/errdefs" (staticcheck)
cerrdefs "github.com/containerd/errdefs"
^
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -5,7 +5,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/containerd/errdefs"
|
cerrdefs "github.com/containerd/errdefs"
|
||||||
"github.com/moby/moby/api/types/container"
|
"github.com/moby/moby/api/types/container"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -152,7 +152,7 @@ func (cli *Client) ExecAttach(ctx context.Context, execID string, options ExecAt
|
|||||||
func getConsoleSize(hasTTY bool, consoleSize ConsoleSize) (*[2]uint, error) {
|
func getConsoleSize(hasTTY bool, consoleSize ConsoleSize) (*[2]uint, error) {
|
||||||
if consoleSize.Height != 0 || consoleSize.Width != 0 {
|
if consoleSize.Height != 0 || consoleSize.Width != 0 {
|
||||||
if !hasTTY {
|
if !hasTTY {
|
||||||
return nil, errdefs.ErrInvalidArgument.WithMessage("console size is only supported when TTY is enabled")
|
return nil, cerrdefs.ErrInvalidArgument.WithMessage("console size is only supported when TTY is enabled")
|
||||||
}
|
}
|
||||||
return &[2]uint{consoleSize.Height, consoleSize.Width}, nil
|
return &[2]uint{consoleSize.Height, consoleSize.Width}, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/containerd/errdefs"
|
|
||||||
cerrdefs "github.com/containerd/errdefs"
|
cerrdefs "github.com/containerd/errdefs"
|
||||||
"github.com/moby/moby/api/types/container"
|
"github.com/moby/moby/api/types/container"
|
||||||
"gotest.tools/v3/assert"
|
"gotest.tools/v3/assert"
|
||||||
@@ -163,7 +162,7 @@ func TestExecStartConsoleSize(t *testing.T) {
|
|||||||
|
|
||||||
_, err = client.ExecStart(t.Context(), "exec_id", tc.options)
|
_, err = client.ExecStart(t.Context(), "exec_id", tc.options)
|
||||||
if tc.expErr != "" {
|
if tc.expErr != "" {
|
||||||
assert.Check(t, is.ErrorType(err, errdefs.IsInvalidArgument))
|
assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
|
||||||
assert.Check(t, is.ErrorContains(err, tc.expErr))
|
assert.Check(t, is.ErrorContains(err, tc.expErr))
|
||||||
assert.Check(t, is.DeepEqual(actualReq, tc.expReq))
|
assert.Check(t, is.DeepEqual(actualReq, tc.expReq))
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/containerd/errdefs"
|
cerrdefs "github.com/containerd/errdefs"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ContainerRenameOptions represents the options for renaming a container.
|
// ContainerRenameOptions represents the options for renaming a container.
|
||||||
@@ -28,7 +28,7 @@ func (cli *Client) ContainerRename(ctx context.Context, containerID string, opti
|
|||||||
if options.NewName == "" || strings.TrimPrefix(options.NewName, "/") == "" {
|
if options.NewName == "" || strings.TrimPrefix(options.NewName, "/") == "" {
|
||||||
// daemons before v29.0 did not handle the canonical name ("/") well
|
// daemons before v29.0 did not handle the canonical name ("/") well
|
||||||
// let's be nice and validate it here before sending
|
// let's be nice and validate it here before sending
|
||||||
return ContainerRenameResult{}, errdefs.ErrInvalidArgument.WithMessage("new name cannot be blank")
|
return ContainerRenameResult{}, cerrdefs.ErrInvalidArgument.WithMessage("new name cannot be blank")
|
||||||
}
|
}
|
||||||
|
|
||||||
query := url.Values{}
|
query := url.Values{}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"gotest.tools/v3/assert"
|
"gotest.tools/v3/assert"
|
||||||
"gotest.tools/v3/assert/cmp"
|
is "gotest.tools/v3/assert/cmp"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestDecode(t *testing.T) {
|
func TestDecode(t *testing.T) {
|
||||||
@@ -161,7 +161,7 @@ func TestDecode(t *testing.T) {
|
|||||||
for _, tc := range tests {
|
for _, tc := range tests {
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
got := DecodeOptions(tc.opts)
|
got := DecodeOptions(tc.opts)
|
||||||
assert.Check(t, cmp.DeepEqual(got, tc.want))
|
assert.Check(t, is.DeepEqual(got, tc.want))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"github.com/containerd/errdefs"
|
cerrdefs "github.com/containerd/errdefs"
|
||||||
"github.com/moby/moby/api/types/volume"
|
"github.com/moby/moby/api/types/volume"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ type VolumePruneResult struct {
|
|||||||
func (cli *Client) VolumePrune(ctx context.Context, options VolumePruneOptions) (VolumePruneResult, error) {
|
func (cli *Client) VolumePrune(ctx context.Context, options VolumePruneOptions) (VolumePruneResult, error) {
|
||||||
if options.All {
|
if options.All {
|
||||||
if _, ok := options.Filters["all"]; ok {
|
if _, ok := options.Filters["all"]; ok {
|
||||||
return VolumePruneResult{}, errdefs.ErrInvalidArgument.WithMessage(`conflicting options: cannot specify both "all" and "all" filter`)
|
return VolumePruneResult{}, cerrdefs.ErrInvalidArgument.WithMessage(`conflicting options: cannot specify both "all" and "all" filter`)
|
||||||
}
|
}
|
||||||
if options.Filters == nil {
|
if options.Filters == nil {
|
||||||
options.Filters = Filters{}
|
options.Filters = Filters{}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/containerd/errdefs"
|
cerrdefs "github.com/containerd/errdefs"
|
||||||
"github.com/moby/moby/api/types/volume"
|
"github.com/moby/moby/api/types/volume"
|
||||||
"gotest.tools/v3/assert"
|
"gotest.tools/v3/assert"
|
||||||
is "gotest.tools/v3/assert/cmp"
|
is "gotest.tools/v3/assert/cmp"
|
||||||
@@ -81,7 +81,7 @@ func TestVolumePrune(t *testing.T) {
|
|||||||
|
|
||||||
_, err = client.VolumePrune(t.Context(), tc.opts)
|
_, err = client.VolumePrune(t.Context(), tc.opts)
|
||||||
if tc.expectedError != "" {
|
if tc.expectedError != "" {
|
||||||
assert.Check(t, is.ErrorType(err, errdefs.IsInvalidArgument))
|
assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
|
||||||
assert.Check(t, is.Error(err, tc.expectedError))
|
assert.Check(t, is.Error(err, tc.expectedError))
|
||||||
} else {
|
} else {
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|||||||
4
vendor/github.com/moby/moby/client/container_exec.go
generated
vendored
4
vendor/github.com/moby/moby/client/container_exec.go
generated
vendored
@@ -5,7 +5,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/containerd/errdefs"
|
cerrdefs "github.com/containerd/errdefs"
|
||||||
"github.com/moby/moby/api/types/container"
|
"github.com/moby/moby/api/types/container"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -152,7 +152,7 @@ func (cli *Client) ExecAttach(ctx context.Context, execID string, options ExecAt
|
|||||||
func getConsoleSize(hasTTY bool, consoleSize ConsoleSize) (*[2]uint, error) {
|
func getConsoleSize(hasTTY bool, consoleSize ConsoleSize) (*[2]uint, error) {
|
||||||
if consoleSize.Height != 0 || consoleSize.Width != 0 {
|
if consoleSize.Height != 0 || consoleSize.Width != 0 {
|
||||||
if !hasTTY {
|
if !hasTTY {
|
||||||
return nil, errdefs.ErrInvalidArgument.WithMessage("console size is only supported when TTY is enabled")
|
return nil, cerrdefs.ErrInvalidArgument.WithMessage("console size is only supported when TTY is enabled")
|
||||||
}
|
}
|
||||||
return &[2]uint{consoleSize.Height, consoleSize.Width}, nil
|
return &[2]uint{consoleSize.Height, consoleSize.Width}, nil
|
||||||
}
|
}
|
||||||
|
|||||||
4
vendor/github.com/moby/moby/client/container_rename.go
generated
vendored
4
vendor/github.com/moby/moby/client/container_rename.go
generated
vendored
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/containerd/errdefs"
|
cerrdefs "github.com/containerd/errdefs"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ContainerRenameOptions represents the options for renaming a container.
|
// ContainerRenameOptions represents the options for renaming a container.
|
||||||
@@ -28,7 +28,7 @@ func (cli *Client) ContainerRename(ctx context.Context, containerID string, opti
|
|||||||
if options.NewName == "" || strings.TrimPrefix(options.NewName, "/") == "" {
|
if options.NewName == "" || strings.TrimPrefix(options.NewName, "/") == "" {
|
||||||
// daemons before v29.0 did not handle the canonical name ("/") well
|
// daemons before v29.0 did not handle the canonical name ("/") well
|
||||||
// let's be nice and validate it here before sending
|
// let's be nice and validate it here before sending
|
||||||
return ContainerRenameResult{}, errdefs.ErrInvalidArgument.WithMessage("new name cannot be blank")
|
return ContainerRenameResult{}, cerrdefs.ErrInvalidArgument.WithMessage("new name cannot be blank")
|
||||||
}
|
}
|
||||||
|
|
||||||
query := url.Values{}
|
query := url.Values{}
|
||||||
|
|||||||
4
vendor/github.com/moby/moby/client/volume_prune.go
generated
vendored
4
vendor/github.com/moby/moby/client/volume_prune.go
generated
vendored
@@ -6,7 +6,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"github.com/containerd/errdefs"
|
cerrdefs "github.com/containerd/errdefs"
|
||||||
"github.com/moby/moby/api/types/volume"
|
"github.com/moby/moby/api/types/volume"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ type VolumePruneResult struct {
|
|||||||
func (cli *Client) VolumePrune(ctx context.Context, options VolumePruneOptions) (VolumePruneResult, error) {
|
func (cli *Client) VolumePrune(ctx context.Context, options VolumePruneOptions) (VolumePruneResult, error) {
|
||||||
if options.All {
|
if options.All {
|
||||||
if _, ok := options.Filters["all"]; ok {
|
if _, ok := options.Filters["all"]; ok {
|
||||||
return VolumePruneResult{}, errdefs.ErrInvalidArgument.WithMessage(`conflicting options: cannot specify both "all" and "all" filter`)
|
return VolumePruneResult{}, cerrdefs.ErrInvalidArgument.WithMessage(`conflicting options: cannot specify both "all" and "all" filter`)
|
||||||
}
|
}
|
||||||
if options.Filters == nil {
|
if options.Filters == nil {
|
||||||
options.Filters = Filters{}
|
options.Filters = Filters{}
|
||||||
|
|||||||
Reference in New Issue
Block a user