From e40529aa3b4846a6ebfd95cd166358f0e0e80f43 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 4 Mar 2022 14:38:45 +0100 Subject: [PATCH] use consistent alias for api/types/registry Not a fan of aliases, but unfortunately they're sometimes needed. We import both docker/docker/registry and docker/registry and api/types/registry, so I looked for which one to continue using an alias, and this was the one "least" used, and which already used this alias everywhere, except for two places. Signed-off-by: Sebastiaan van Stijn --- cli/command/registry/formatter_search.go | 6 +++--- cli/command/system/info_test.go | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cli/command/registry/formatter_search.go b/cli/command/registry/formatter_search.go index bbd043e0b9..8c76d0980e 100644 --- a/cli/command/registry/formatter_search.go +++ b/cli/command/registry/formatter_search.go @@ -5,7 +5,7 @@ import ( "strings" "github.com/docker/cli/cli/command/formatter" - registry "github.com/docker/docker/api/types/registry" + registrytypes "github.com/docker/docker/api/types/registry" ) const ( @@ -28,7 +28,7 @@ func NewSearchFormat(source string) formatter.Format { } // SearchWrite writes the context -func SearchWrite(ctx formatter.Context, results []registry.SearchResult) error { +func SearchWrite(ctx formatter.Context, results []registrytypes.SearchResult) error { render := func(format func(subContext formatter.SubContext) error) error { for _, result := range results { searchCtx := &searchContext{trunc: ctx.Trunc, s: result} @@ -53,7 +53,7 @@ type searchContext struct { formatter.HeaderContext trunc bool json bool - s registry.SearchResult + s registrytypes.SearchResult } func (c *searchContext) MarshalJSON() ([]byte, error) { diff --git a/cli/command/system/info_test.go b/cli/command/system/info_test.go index bbd0288057..4bd489f955 100644 --- a/cli/command/system/info_test.go +++ b/cli/command/system/info_test.go @@ -9,7 +9,7 @@ import ( pluginmanager "github.com/docker/cli/cli-plugins/manager" "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" - "github.com/docker/docker/api/types/registry" + registrytypes "github.com/docker/docker/api/types/registry" "github.com/docker/docker/api/types/swarm" "gotest.tools/v3/assert" is "gotest.tools/v3/assert/cmp" @@ -69,16 +69,16 @@ var sampleInfoNoSwarm = types.Info{ OSType: "linux", Architecture: "x86_64", IndexServerAddress: "https://index.docker.io/v1/", - RegistryConfig: ®istry.ServiceConfig{ + RegistryConfig: ®istrytypes.ServiceConfig{ AllowNondistributableArtifactsCIDRs: nil, AllowNondistributableArtifactsHostnames: nil, - InsecureRegistryCIDRs: []*registry.NetIPNet{ + InsecureRegistryCIDRs: []*registrytypes.NetIPNet{ { IP: net.ParseIP("127.0.0.0"), Mask: net.IPv4Mask(255, 0, 0, 0), }, }, - IndexConfigs: map[string]*registry.IndexInfo{ + IndexConfigs: map[string]*registrytypes.IndexInfo{ "docker.io": { Name: "docker.io", Mirrors: nil,