Pārlūkot izejas kodu

Merge pull request #24175 from allencloud/fix-comments-and-handle-err

fix comments and handle err
Vincent Demeester 9 gadi atpakaļ
vecāks
revīzija
cbc4fd2131

+ 2 - 2
api/client/inspect.go

@@ -86,10 +86,10 @@ func (cli *DockerCli) inspectAll(ctx context.Context, getSize bool) inspect.GetR
 					}
 					}
 					return nil, nil, err
 					return nil, nil, err
 				}
 				}
-				return i, rawImage, err
+				return i, rawImage, nil
 			}
 			}
 			return nil, nil, err
 			return nil, nil, err
 		}
 		}
-		return c, rawContainer, err
+		return c, rawContainer, nil
 	}
 	}
 }
 }

+ 4 - 0
api/client/plugin/install.go

@@ -57,6 +57,10 @@ func runInstall(dockerCli *client.DockerCli, opts pluginOptions) error {
 	ctx := context.Background()
 	ctx := context.Background()
 
 
 	repoInfo, err := registry.ParseRepositoryInfo(named)
 	repoInfo, err := registry.ParseRepositoryInfo(named)
+	if err != nil {
+		return err
+	}
+
 	authConfig := dockerCli.ResolveAuthConfig(ctx, repoInfo.Index)
 	authConfig := dockerCli.ResolveAuthConfig(ctx, repoInfo.Index)
 
 
 	encodedAuth, err := client.EncodeAuthToBase64(authConfig)
 	encodedAuth, err := client.EncodeAuthToBase64(authConfig)

+ 3 - 0
api/client/plugin/push.go

@@ -42,6 +42,9 @@ func runPush(dockerCli *client.DockerCli, name string) error {
 	ctx := context.Background()
 	ctx := context.Background()
 
 
 	repoInfo, err := registry.ParseRepositoryInfo(named)
 	repoInfo, err := registry.ParseRepositoryInfo(named)
+	if err != nil {
+		return err
+	}
 	authConfig := dockerCli.ResolveAuthConfig(ctx, repoInfo.Index)
 	authConfig := dockerCli.ResolveAuthConfig(ctx, repoInfo.Index)
 
 
 	encodedAuth, err := client.EncodeAuthToBase64(authConfig)
 	encodedAuth, err := client.EncodeAuthToBase64(authConfig)

+ 2 - 2
api/client/registry.go

@@ -42,7 +42,7 @@ func EncodeAuthToBase64(authConfig types.AuthConfig) (string, error) {
 	return base64.URLEncoding.EncodeToString(buf), nil
 	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.
 // for the given command.
 func (cli *DockerCli) RegistryAuthenticationPrivilegedFunc(index *registrytypes.IndexInfo, cmdName string) types.RequestPrivilegeFunc {
 func (cli *DockerCli) RegistryAuthenticationPrivilegedFunc(index *registrytypes.IndexInfo, cmdName string) types.RequestPrivilegeFunc {
 	return func() (string, error) {
 	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
 	// will hit this if you attempt docker login from mintty where stdin
 	// is a pipe, not a character based console.
 	// is a pipe, not a character based console.
 	if flPassword == "" && !cli.isTerminalIn {
 	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)
 	authconfig.Username = strings.TrimSpace(authconfig.Username)

+ 2 - 2
api/client/stack/cmd_stub.go

@@ -7,12 +7,12 @@ import (
 	"github.com/spf13/cobra"
 	"github.com/spf13/cobra"
 )
 )
 
 
-// NewStackCommand returns nocommand
+// NewStackCommand returns no command
 func NewStackCommand(dockerCli *client.DockerCli) *cobra.Command {
 func NewStackCommand(dockerCli *client.DockerCli) *cobra.Command {
 	return &cobra.Command{}
 	return &cobra.Command{}
 }
 }
 
 
-// NewTopLevelDeployCommand return no command
+// NewTopLevelDeployCommand returns no command
 func NewTopLevelDeployCommand(dockerCli *client.DockerCli) *cobra.Command {
 func NewTopLevelDeployCommand(dockerCli *client.DockerCli) *cobra.Command {
 	return &cobra.Command{}
 	return &cobra.Command{}
 }
 }