From ca9c8d104e83f7b39477e0f927989f062c1aa423 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Thu, 4 Sep 2025 14:02:50 +0200 Subject: [PATCH 1/2] update module github.com/spf13/pflag to v1.0.10 Signed-off-by: Paul Holzinger --- go.mod | 2 +- go.sum | 3 ++- vendor/github.com/spf13/pflag/flag.go | 14 ++++++++------ vendor/modules.txt | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index aa23c43e3e..0210b5e2f7 100644 --- a/go.mod +++ b/go.mod @@ -60,7 +60,7 @@ require ( github.com/shirou/gopsutil/v4 v4.25.8 github.com/sirupsen/logrus v1.9.3 github.com/spf13/cobra v1.10.1 - github.com/spf13/pflag v1.0.9 + github.com/spf13/pflag v1.0.10 github.com/stretchr/testify v1.11.1 github.com/vbauerster/mpb/v8 v8.10.2 github.com/vishvananda/netlink v1.3.1 diff --git a/go.sum b/go.sum index b1c9b1dd5e..48d27bbf83 100644 --- a/go.sum +++ b/go.sum @@ -365,8 +365,9 @@ github.com/smallstep/pkcs7 v0.1.1 h1:x+rPdt2W088V9Vkjho4KtoggyktZJlMduZAtRHm68LU github.com/smallstep/pkcs7 v0.1.1/go.mod h1:dL6j5AIz9GHjVEBTXtW+QliALcgM19RtXaTeyxI+AfA= github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s= github.com/spf13/cobra v1.10.1/go.mod h1:7SmJGaTHFVBY0jW4NXGluQoLvhqFQM+6XSKD+P4XaB0= -github.com/spf13/pflag v1.0.9 h1:9exaQaMOCwffKiiiYk6/BndUBv+iRViNW+4lEMi0PvY= github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= +github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stefanberger/go-pkcs11uri v0.0.0-20230803200340-78284954bff6 h1:pnnLyeX7o/5aX8qUQ69P/mLojDqwda8hFOCBTmP/6hw= github.com/stefanberger/go-pkcs11uri v0.0.0-20230803200340-78284954bff6/go.mod h1:39R/xuhNgVhi+K0/zst4TLrJrVmbm6LVgl4A0+ZFS5M= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/vendor/github.com/spf13/pflag/flag.go b/vendor/github.com/spf13/pflag/flag.go index eeed1e92b0..2fd3c57597 100644 --- a/vendor/github.com/spf13/pflag/flag.go +++ b/vendor/github.com/spf13/pflag/flag.go @@ -143,8 +143,9 @@ type ParseErrorsAllowlist struct { UnknownFlags bool } -// DEPRECATED: please use ParseErrorsAllowlist instead -// This type will be removed in a future release +// ParseErrorsWhitelist defines the parsing errors that can be ignored. +// +// Deprecated: use [ParseErrorsAllowlist] instead. This type will be removed in a future release. type ParseErrorsWhitelist = ParseErrorsAllowlist // NormalizedName is a flag name that has been normalized according to rules @@ -165,8 +166,9 @@ type FlagSet struct { // ParseErrorsAllowlist is used to configure an allowlist of errors ParseErrorsAllowlist ParseErrorsAllowlist - // DEPRECATED: please use ParseErrorsAllowlist instead - // This field will be removed in a future release + // ParseErrorsAllowlist is used to configure an allowlist of errors. + // + // Deprecated: use [FlagSet.ParseErrorsAllowlist] instead. This field will be removed in a future release. ParseErrorsWhitelist ParseErrorsAllowlist name string @@ -1185,7 +1187,7 @@ func (f *FlagSet) Parse(arguments []string) error { case ContinueOnError: return err case ExitOnError: - if errors.Is(err, ErrHelp) { + if err == ErrHelp { os.Exit(0) } fmt.Fprintln(f.Output(), err) @@ -1214,7 +1216,7 @@ func (f *FlagSet) ParseAll(arguments []string, fn func(flag *Flag, value string) case ContinueOnError: return err case ExitOnError: - if errors.Is(err, ErrHelp) { + if err == ErrHelp { os.Exit(0) } fmt.Fprintln(f.Output(), err) diff --git a/vendor/modules.txt b/vendor/modules.txt index 5e181df93d..9870a59d1b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -648,7 +648,7 @@ github.com/smallstep/pkcs7/internal/legacy/x509 # github.com/spf13/cobra v1.10.1 ## explicit; go 1.15 github.com/spf13/cobra -# github.com/spf13/pflag v1.0.9 +# github.com/spf13/pflag v1.0.10 ## explicit; go 1.12 github.com/spf13/pflag # github.com/stefanberger/go-pkcs11uri v0.0.0-20230803200340-78284954bff6 From c2506656c46ce7f893e5c8031c74eb33080704f5 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Thu, 4 Sep 2025 14:04:47 +0200 Subject: [PATCH 2/2] spf13/pflag: replace deprecated ParseErrorsWhitelist Use ParseErrorsAllowlist instead, should still work the exact same. Signed-off-by: Paul Holzinger --- cmd/podman/compose.go | 2 +- cmd/podman/registry/config.go | 2 +- cmd/podman/registry/remote.go | 2 +- pkg/systemd/generate/containers.go | 2 +- pkg/systemd/generate/pods.go | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/podman/compose.go b/cmd/podman/compose.go index 3ff6865ece..c6265c9abb 100644 --- a/cmd/podman/compose.go +++ b/cmd/podman/compose.go @@ -254,7 +254,7 @@ func composeMain(cmd *cobra.Command, args []string) error { // after `podman compose [ARGS]` are passed to the compose provider. // For now, we only look for the --help flag. fs := pflag.NewFlagSet("args", pflag.ContinueOnError) - fs.ParseErrorsWhitelist.UnknownFlags = true + fs.ParseErrorsAllowlist.UnknownFlags = true fs.SetInterspersed(false) fs.BoolP("help", "h", false, "") if err := fs.Parse(args); err != nil { diff --git a/cmd/podman/registry/config.go b/cmd/podman/registry/config.go index d40a1e29ca..f7fc808227 100644 --- a/cmd/podman/registry/config.go +++ b/cmd/podman/registry/config.go @@ -70,7 +70,7 @@ func containersConfModules() ([]string, error) { var modules []string fs := pflag.NewFlagSet("module", pflag.ContinueOnError) - fs.ParseErrorsWhitelist.UnknownFlags = true + fs.ParseErrorsAllowlist.UnknownFlags = true fs.Usage = func() {} fs.SetInterspersed(false) fs.StringArrayVar(&modules, "module", nil, "") diff --git a/cmd/podman/registry/remote.go b/cmd/podman/registry/remote.go index 0000722f91..2ff53a038d 100644 --- a/cmd/podman/registry/remote.go +++ b/cmd/podman/registry/remote.go @@ -36,7 +36,7 @@ func IsRemote() bool { remote = true } fs := pflag.NewFlagSet("remote", pflag.ContinueOnError) - fs.ParseErrorsWhitelist.UnknownFlags = true + fs.ParseErrorsAllowlist.UnknownFlags = true fs.Usage = func() {} fs.SetInterspersed(false) fs.BoolVarP(&remoteFromCLI.Value, "remote", "r", remote, "") diff --git a/pkg/systemd/generate/containers.go b/pkg/systemd/generate/containers.go index 1990621514..7878f80fb0 100644 --- a/pkg/systemd/generate/containers.go +++ b/pkg/systemd/generate/containers.go @@ -358,7 +358,7 @@ func executeContainerTemplate(info *containerInfo, options entities.GenerateSyst remainingCmd := info.CreateCommand[index:] // Presence check for certain flags/options. fs := pflag.NewFlagSet("args", pflag.ContinueOnError) - fs.ParseErrorsWhitelist.UnknownFlags = true + fs.ParseErrorsAllowlist.UnknownFlags = true fs.Usage = func() {} fs.SetInterspersed(false) fs.BoolP("detach", "d", false, "") diff --git a/pkg/systemd/generate/pods.go b/pkg/systemd/generate/pods.go index 3c97973295..81ca410bd8 100644 --- a/pkg/systemd/generate/pods.go +++ b/pkg/systemd/generate/pods.go @@ -339,7 +339,7 @@ func executePodTemplate(info *podInfo, options entities.GenerateSystemdOptions) // Presence check for certain flags/options. fs := pflag.NewFlagSet("args", pflag.ContinueOnError) - fs.ParseErrorsWhitelist.UnknownFlags = true + fs.ParseErrorsAllowlist.UnknownFlags = true fs.Usage = func() {} fs.SetInterspersed(false) fs.String("name", "", "")