From cc054f3195308da471c252d755dacfe446cb1066 Mon Sep 17 00:00:00 2001 From: allencloud Date: Wed, 29 Jun 2016 17:26:42 +0800 Subject: [PATCH] fix comments and handle err Signed-off-by: allencloud --- api/client/inspect.go | 4 ++-- api/client/plugin/install.go | 4 ++++ api/client/plugin/push.go | 3 +++ api/client/registry.go | 4 ++-- api/client/stack/cmd_stub.go | 4 ++-- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/api/client/inspect.go b/api/client/inspect.go index 3b107a7e43..e8c0de64e1 100644 --- a/api/client/inspect.go +++ b/api/client/inspect.go @@ -86,10 +86,10 @@ func (cli *DockerCli) inspectAll(ctx context.Context, getSize bool) inspect.GetR } return nil, nil, err } - return i, rawImage, err + return i, rawImage, nil } return nil, nil, err } - return c, rawContainer, err + return c, rawContainer, nil } } diff --git a/api/client/plugin/install.go b/api/client/plugin/install.go index ea73498c26..310e7229d0 100644 --- a/api/client/plugin/install.go +++ b/api/client/plugin/install.go @@ -57,6 +57,10 @@ func runInstall(dockerCli *client.DockerCli, opts pluginOptions) error { ctx := context.Background() repoInfo, err := registry.ParseRepositoryInfo(named) + if err != nil { + return err + } + authConfig := dockerCli.ResolveAuthConfig(ctx, repoInfo.Index) encodedAuth, err := client.EncodeAuthToBase64(authConfig) diff --git a/api/client/plugin/push.go b/api/client/plugin/push.go index d26fab8dfc..9ef4907961 100644 --- a/api/client/plugin/push.go +++ b/api/client/plugin/push.go @@ -42,6 +42,9 @@ func runPush(dockerCli *client.DockerCli, name string) error { ctx := context.Background() repoInfo, err := registry.ParseRepositoryInfo(named) + if err != nil { + return err + } authConfig := dockerCli.ResolveAuthConfig(ctx, repoInfo.Index) encodedAuth, err := client.EncodeAuthToBase64(authConfig) diff --git a/api/client/registry.go b/api/client/registry.go index 26a8c8f268..f8e40725f2 100644 --- a/api/client/registry.go +++ b/api/client/registry.go @@ -42,7 +42,7 @@ func EncodeAuthToBase64(authConfig types.AuthConfig) (string, error) { return base64.URLEncoding.EncodeToString(buf), nil } -// RegistryAuthenticationPrivilegedFunc return a RequestPrivilegeFunc from the specified registry index info +// RegistryAuthenticationPrivilegedFunc returns a RequestPrivilegeFunc from the specified registry index info // for the given command. func (cli *DockerCli) RegistryAuthenticationPrivilegedFunc(index *registrytypes.IndexInfo, cmdName string) types.RequestPrivilegeFunc { return func() (string, error) { @@ -103,7 +103,7 @@ func (cli *DockerCli) ConfigureAuth(flUser, flPassword, serverAddress string, is // will hit this if you attempt docker login from mintty where stdin // is a pipe, not a character based console. if flPassword == "" && !cli.isTerminalIn { - return authconfig, fmt.Errorf("Error: Cannot perform an interactive logon from a non TTY device") + return authconfig, fmt.Errorf("Error: Cannot perform an interactive login from a non TTY device") } authconfig.Username = strings.TrimSpace(authconfig.Username) diff --git a/api/client/stack/cmd_stub.go b/api/client/stack/cmd_stub.go index 76b83e3646..0efc56300b 100644 --- a/api/client/stack/cmd_stub.go +++ b/api/client/stack/cmd_stub.go @@ -7,12 +7,12 @@ import ( "github.com/spf13/cobra" ) -// NewStackCommand returns nocommand +// NewStackCommand returns no command func NewStackCommand(dockerCli *client.DockerCli) *cobra.Command { return &cobra.Command{} } -// NewTopLevelDeployCommand return no command +// NewTopLevelDeployCommand returns no command func NewTopLevelDeployCommand(dockerCli *client.DockerCli) *cobra.Command { return &cobra.Command{} }