From fb61156b05b584712f5006abe4695fac9070facd Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sun, 20 Oct 2024 17:51:12 +0200 Subject: [PATCH 1/2] cli/command/registry: fix minor linting issues - fix camelCase naming of verifyLoginOptions - suppress unhandled errors that can be ignored Signed-off-by: Sebastiaan van Stijn --- cli/command/registry/login.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cli/command/registry/login.go b/cli/command/registry/login.go index 5a9e8118f3e0..ec509a1aea8e 100644 --- a/cli/command/registry/login.go +++ b/cli/command/registry/login.go @@ -58,9 +58,9 @@ func NewLoginCommand(dockerCli command.Cli) *cobra.Command { return cmd } -func verifyloginOptions(dockerCli command.Cli, opts *loginOptions) error { +func verifyLoginOptions(dockerCli command.Cli, opts *loginOptions) error { if opts.password != "" { - fmt.Fprintln(dockerCli.Err(), "WARNING! Using --password via the CLI is insecure. Use --password-stdin.") + _, _ = fmt.Fprintln(dockerCli.Err(), "WARNING! Using --password via the CLI is insecure. Use --password-stdin.") if opts.passwordStdin { return errors.New("--password and --password-stdin are mutually exclusive") } @@ -83,7 +83,7 @@ func verifyloginOptions(dockerCli command.Cli, opts *loginOptions) error { } func runLogin(ctx context.Context, dockerCli command.Cli, opts loginOptions) error { - if err := verifyloginOptions(dockerCli, &opts); err != nil { + if err := verifyLoginOptions(dockerCli, &opts); err != nil { return err } var ( @@ -174,7 +174,7 @@ func loginUser(ctx context.Context, dockerCli command.Cli, opts loginOptions, de if !errors.Is(err, manager.ErrDeviceLoginStartFail) { return response, err } - fmt.Fprint(dockerCli.Err(), "Failed to start web-based login - falling back to command line login...\n\n") + _, _ = fmt.Fprint(dockerCli.Err(), "Failed to start web-based login - falling back to command line login...\n\n") } return loginWithUsernameAndPassword(ctx, dockerCli, opts, defaultUsername, serverAddress) From 6b9083776fd04509183edaaf3a7c31a51fb3b61b Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sun, 20 Oct 2024 17:51:36 +0200 Subject: [PATCH 2/2] cli/command: AddPlatformFlag: suppress unhandled error Signed-off-by: Sebastiaan van Stijn --- cli/command/utils.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/command/utils.go b/cli/command/utils.go index 1cf4d199de02..73b61b34602c 100644 --- a/cli/command/utils.go +++ b/cli/command/utils.go @@ -199,7 +199,7 @@ func PruneFilters(dockerCli Cli, pruneFilters filters.Args) filters.Args { // AddPlatformFlag adds `platform` to a set of flags for API version 1.32 and later. func AddPlatformFlag(flags *pflag.FlagSet, target *string) { flags.StringVar(target, "platform", os.Getenv("DOCKER_DEFAULT_PLATFORM"), "Set platform if server is multi-platform capable") - flags.SetAnnotation("platform", "version", []string{"1.32"}) + _ = flags.SetAnnotation("platform", "version", []string{"1.32"}) } // ValidateOutputPath validates the output paths of the `export` and `save` commands.