From e0b47cc2cc1570750421cc5d0fefa884b9dbe291 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 11 Apr 2023 20:19:17 +0200 Subject: [PATCH] cli/command/image: imagePullPrivileged: remove intermediate variables Signed-off-by: Sebastiaan van Stijn --- cli/command/image/trust.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/cli/command/image/trust.go b/cli/command/image/trust.go index 98c325b061..3da1e8032e 100644 --- a/cli/command/image/trust.go +++ b/cli/command/image/trust.go @@ -262,20 +262,17 @@ func getTrustedPullTargets(cli command.Cli, imgRefAndAuth trust.ImageRefAndAuth) // imagePullPrivileged pulls the image and displays it to the output func imagePullPrivileged(ctx context.Context, cli command.Cli, imgRefAndAuth trust.ImageRefAndAuth, opts PullOptions) error { - ref := reference.FamiliarString(imgRefAndAuth.Reference()) - encodedAuth, err := registrytypes.EncodeAuthConfig(*imgRefAndAuth.AuthConfig()) if err != nil { return err } requestPrivilege := command.RegistryAuthenticationPrivilegedFunc(cli, imgRefAndAuth.RepoInfo().Index, "pull") - options := types.ImagePullOptions{ + responseBody, err := cli.Client().ImagePull(ctx, reference.FamiliarString(imgRefAndAuth.Reference()), types.ImagePullOptions{ RegistryAuth: encodedAuth, PrivilegeFunc: requestPrivilege, All: opts.all, Platform: opts.platform, - } - responseBody, err := cli.Client().ImagePull(ctx, ref, options) + }) if err != nil { return err }