From 168a4bdc05a3a1d5ee86906b76980702970605d1 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 19 Oct 2024 12:52:32 +0200 Subject: [PATCH] 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 (cherry picked from commit 4b7a1e461308dfe1c5d620d07fb2b756bd944a7d) Signed-off-by: Sebastiaan van Stijn --- cli/command/registry.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cli/command/registry.go b/cli/command/registry.go index 55754a8449..cb966be1a7 100644 --- a/cli/command/registry.go +++ b/cli/command/registry.go @@ -31,12 +31,12 @@ const ( // for the given command. func RegistryAuthenticationPrivilegedFunc(cli Cli, index *registrytypes.IndexInfo, cmdName string) types.RequestPrivilegeFunc { 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) isDefaultRegistry := indexServer == registry.IndexServer authConfig, err := GetDefaultAuthConfig(cli.ConfigFile(), true, indexServer, isDefaultRegistry) 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 { @@ -137,8 +137,8 @@ func PromptUserForCredentials(ctx context.Context, cli Cli, argUser, argPassword // a token instead of a password. _, _ = fmt.Fprintln(cli.Out(), registerSuggest) if hints.Enabled() { - fmt.Fprintln(cli.Out(), patSuggest) - fmt.Fprintln(cli.Out()) + _, _ = fmt.Fprintln(cli.Out(), patSuggest) + _, _ = fmt.Fprintln(cli.Out()) } } @@ -183,7 +183,7 @@ func PromptUserForCredentials(ctx context.Context, cli Cli, argUser, argPassword if err != nil { return registrytypes.AuthConfig{}, err } - fmt.Fprint(cli.Out(), "\n") + _, _ = fmt.Fprintln(cli.Out()) if argPassword == "" { return registrytypes.AuthConfig{}, errors.Errorf("Error: Password Required") }