linting: ST1019: package is being imported more than once (stylecheck)

cli/command/manifest/inspect_test.go:9:2: ST1019: package "github.com/docker/cli/cli/manifest/types" is being imported more than once (stylecheck)
        "github.com/docker/cli/cli/manifest/types"
        ^
    cli/command/manifest/inspect_test.go:10:2: ST1019(related information): other import of "github.com/docker/cli/cli/manifest/types" (stylecheck)
        manifesttypes "github.com/docker/cli/cli/manifest/types"
        ^
    cli/command/stack/swarm/deploy_composefile.go:14:2: ST1019: package "github.com/docker/docker/client" is being imported more than once (stylecheck)
        apiclient "github.com/docker/docker/client"
        ^
    cli/command/stack/swarm/deploy_composefile.go:15:2: ST1019(related information): other import of "github.com/docker/docker/client" (stylecheck)
        dockerclient "github.com/docker/docker/client"
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-09-02 22:49:01 +02:00
parent 491407b541
commit ce01160e74
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
3 changed files with 8 additions and 10 deletions

View File

@ -7,7 +7,6 @@ import (
"github.com/docker/cli/cli/manifest/store" "github.com/docker/cli/cli/manifest/store"
"github.com/docker/cli/cli/manifest/types" "github.com/docker/cli/cli/manifest/types"
manifesttypes "github.com/docker/cli/cli/manifest/types"
"github.com/docker/cli/internal/test" "github.com/docker/cli/internal/test"
"github.com/docker/distribution" "github.com/docker/distribution"
"github.com/docker/distribution/manifest/schema2" "github.com/docker/distribution/manifest/schema2"
@ -80,10 +79,10 @@ func TestInspectCommandNotFound(t *testing.T) {
cli := test.NewFakeCli(nil) cli := test.NewFakeCli(nil)
cli.SetManifestStore(store) cli.SetManifestStore(store)
cli.SetRegistryClient(&fakeRegistryClient{ cli.SetRegistryClient(&fakeRegistryClient{
getManifestFunc: func(_ context.Context, _ reference.Named) (manifesttypes.ImageManifest, error) { getManifestFunc: func(_ context.Context, _ reference.Named) (types.ImageManifest, error) {
return manifesttypes.ImageManifest{}, errors.New("missing") return types.ImageManifest{}, errors.New("missing")
}, },
getManifestListFunc: func(ctx context.Context, ref reference.Named) ([]manifesttypes.ImageManifest, error) { getManifestListFunc: func(ctx context.Context, ref reference.Named) ([]types.ImageManifest, error) {
return nil, errors.Errorf("No such manifest: %s", ref) return nil, errors.Errorf("No such manifest: %s", ref)
}, },
}) })
@ -119,7 +118,7 @@ func TestInspectcommandRemoteManifest(t *testing.T) {
cli := test.NewFakeCli(nil) cli := test.NewFakeCli(nil)
cli.SetManifestStore(store) cli.SetManifestStore(store)
cli.SetRegistryClient(&fakeRegistryClient{ cli.SetRegistryClient(&fakeRegistryClient{
getManifestFunc: func(_ context.Context, ref reference.Named) (manifesttypes.ImageManifest, error) { getManifestFunc: func(_ context.Context, ref reference.Named) (types.ImageManifest, error) {
return fullImageManifest(t, ref), nil return fullImageManifest(t, ref), nil
}, },
}) })

View File

@ -12,7 +12,6 @@ import (
"github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/swarm" "github.com/docker/docker/api/types/swarm"
apiclient "github.com/docker/docker/client" apiclient "github.com/docker/docker/client"
dockerclient "github.com/docker/docker/client"
"github.com/pkg/errors" "github.com/pkg/errors"
) )
@ -77,7 +76,7 @@ func getServicesDeclaredNetworks(serviceConfigs []composetypes.ServiceConfig) ma
return serviceNetworks return serviceNetworks
} }
func validateExternalNetworks(ctx context.Context, client dockerclient.NetworkAPIClient, externalNetworks []string) error { func validateExternalNetworks(ctx context.Context, client apiclient.NetworkAPIClient, externalNetworks []string) error {
for _, networkName := range externalNetworks { for _, networkName := range externalNetworks {
if !container.NetworkMode(networkName).IsUserDefined() { if !container.NetworkMode(networkName).IsUserDefined() {
// Networks that are not user defined always exist on all nodes as // Networks that are not user defined always exist on all nodes as
@ -86,7 +85,7 @@ func validateExternalNetworks(ctx context.Context, client dockerclient.NetworkAP
} }
network, err := client.NetworkInspect(ctx, networkName, types.NetworkInspectOptions{}) network, err := client.NetworkInspect(ctx, networkName, types.NetworkInspectOptions{})
switch { switch {
case dockerclient.IsErrNotFound(err): case apiclient.IsErrNotFound(err):
return errors.Errorf("network %q is declared as external, but could not be found. You need to create a swarm-scoped network before the stack is deployed", networkName) return errors.Errorf("network %q is declared as external, but could not be found. You need to create a swarm-scoped network before the stack is deployed", networkName)
case err != nil: case err != nil:
return err return err

View File

@ -11,7 +11,7 @@ import (
"github.com/docker/cli/internal/test" "github.com/docker/cli/internal/test"
notaryfake "github.com/docker/cli/internal/test/notary" notaryfake "github.com/docker/cli/internal/test/notary"
"github.com/docker/docker/api/types" "github.com/docker/docker/api/types"
dockerClient "github.com/docker/docker/client" apiclient "github.com/docker/docker/client"
"github.com/theupdateframework/notary" "github.com/theupdateframework/notary"
"github.com/theupdateframework/notary/client" "github.com/theupdateframework/notary/client"
"github.com/theupdateframework/notary/tuf/data" "github.com/theupdateframework/notary/tuf/data"
@ -24,7 +24,7 @@ import (
// TODO(n4ss): remove common tests with the regular inspect command // TODO(n4ss): remove common tests with the regular inspect command
type fakeClient struct { type fakeClient struct {
dockerClient.Client apiclient.Client
} }
func (c *fakeClient) Info(ctx context.Context) (types.Info, error) { func (c *fakeClient) Info(ctx context.Context) (types.Info, error) {