From 6c78a72995543344880df5ce1f486bf9711f7818 Mon Sep 17 00:00:00 2001 From: qianxi0410 <894871277@qq.com> Date: Wed, 8 May 2024 23:01:13 +0800 Subject: [PATCH] Remove duplicate call Signed-off-by: qianxi0410 <894871277@qq.com> --- cmd/podman/images/pull.go | 11 +++++------ cmd/podman/images/push.go | 10 +++++----- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/cmd/podman/images/pull.go b/cmd/podman/images/pull.go index 95f6687072..d9669db874 100644 --- a/cmd/podman/images/pull.go +++ b/cmd/podman/images/pull.go @@ -122,15 +122,14 @@ func pullFlags(cmd *cobra.Command) { if registry.IsRemote() { _ = flags.MarkHidden(decryptionKeysFlagName) - } - if !registry.IsRemote() { + } else { certDirFlagName := "cert-dir" flags.StringVar(&pullOptions.CertDir, certDirFlagName, "", "`Pathname` of a directory containing TLS certificates and keys") _ = cmd.RegisterFlagCompletionFunc(certDirFlagName, completion.AutocompleteDefault) - } - if !registry.IsRemote() { - flags.StringVar(&pullOptions.SignaturePolicy, "signature-policy", "", "`Pathname` of signature policy file (not usually used)") - _ = flags.MarkHidden("signature-policy") + + signaturePolicyFlagName := "signature-policy" + flags.StringVar(&pullOptions.SignaturePolicy, signaturePolicyFlagName, "", "`Pathname` of signature policy file (not usually used)") + _ = flags.MarkHidden(signaturePolicyFlagName) } } diff --git a/cmd/podman/images/push.go b/cmd/podman/images/push.go index 2288ee7e8d..a27e0756e3 100644 --- a/cmd/podman/images/push.go +++ b/cmd/podman/images/push.go @@ -162,10 +162,10 @@ func pushFlags(cmd *cobra.Command) { _ = flags.MarkHidden(signPassphraseFileFlagName) _ = flags.MarkHidden(encryptionKeysFlagName) _ = flags.MarkHidden(encryptLayersFlagName) - } - if !registry.IsRemote() { - flags.StringVar(&pushOptions.SignaturePolicy, "signature-policy", "", "Path to a signature-policy file") - _ = flags.MarkHidden("signature-policy") + } else { + signaturePolicyFlagName := "signature-policy" + flags.StringVar(&pushOptions.SignaturePolicy, signaturePolicyFlagName, "", "Path to a signature-policy file") + _ = flags.MarkHidden(signaturePolicyFlagName) } } @@ -257,7 +257,7 @@ func imagePush(cmd *cobra.Command, args []string) error { } if pushOptions.DigestFile != "" { - if err := os.WriteFile(pushOptions.DigestFile, []byte(report.ManifestDigest), 0644); err != nil { + if err := os.WriteFile(pushOptions.DigestFile, []byte(report.ManifestDigest), 0o644); err != nil { return err } }