mirror of https://github.com/docker/cli.git
cli/command: PromptUserForCredentials: suppress unhandled errors
Keep the linters (and my IDE) happy; these errors should be safe to ignore. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
378a3d7d36
commit
4b7a1e4613
|
@ -30,12 +30,12 @@ const (
|
||||||
// for the given command.
|
// for the given command.
|
||||||
func RegistryAuthenticationPrivilegedFunc(cli Cli, index *registrytypes.IndexInfo, cmdName string) registrytypes.RequestAuthConfig {
|
func RegistryAuthenticationPrivilegedFunc(cli Cli, index *registrytypes.IndexInfo, cmdName string) registrytypes.RequestAuthConfig {
|
||||||
return func(ctx context.Context) (string, error) {
|
return func(ctx context.Context) (string, error) {
|
||||||
fmt.Fprintf(cli.Out(), "\nLogin prior to %s:\n", cmdName)
|
_, _ = fmt.Fprintf(cli.Out(), "\nLogin prior to %s:\n", cmdName)
|
||||||
indexServer := registry.GetAuthConfigKey(index)
|
indexServer := registry.GetAuthConfigKey(index)
|
||||||
isDefaultRegistry := indexServer == registry.IndexServer
|
isDefaultRegistry := indexServer == registry.IndexServer
|
||||||
authConfig, err := GetDefaultAuthConfig(cli.ConfigFile(), true, indexServer, isDefaultRegistry)
|
authConfig, err := GetDefaultAuthConfig(cli.ConfigFile(), true, indexServer, isDefaultRegistry)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(cli.Err(), "Unable to retrieve stored credentials for %s, error: %s.\n", indexServer, err)
|
_, _ = fmt.Fprintf(cli.Err(), "Unable to retrieve stored credentials for %s, error: %s.\n", indexServer, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
|
@ -135,8 +135,8 @@ func PromptUserForCredentials(ctx context.Context, cli Cli, argUser, argPassword
|
||||||
// a token instead of a password.
|
// a token instead of a password.
|
||||||
_, _ = fmt.Fprintln(cli.Out(), registerSuggest)
|
_, _ = fmt.Fprintln(cli.Out(), registerSuggest)
|
||||||
if hints.Enabled() {
|
if hints.Enabled() {
|
||||||
fmt.Fprintln(cli.Out(), patSuggest)
|
_, _ = fmt.Fprintln(cli.Out(), patSuggest)
|
||||||
fmt.Fprintln(cli.Out())
|
_, _ = fmt.Fprintln(cli.Out())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ func PromptUserForCredentials(ctx context.Context, cli Cli, argUser, argPassword
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return registrytypes.AuthConfig{}, err
|
return registrytypes.AuthConfig{}, err
|
||||||
}
|
}
|
||||||
fmt.Fprint(cli.Out(), "\n")
|
_, _ = fmt.Fprintln(cli.Out())
|
||||||
if argPassword == "" {
|
if argPassword == "" {
|
||||||
return registrytypes.AuthConfig{}, errors.Errorf("Error: Password Required")
|
return registrytypes.AuthConfig{}, errors.Errorf("Error: Password Required")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue