diff --git a/cli/command/container/opts.go b/cli/command/container/opts.go index 723537e87c..c2253d6c00 100644 --- a/cli/command/container/opts.go +++ b/cli/command/container/opts.go @@ -1,3 +1,6 @@ +// FIXME(vvoland): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: +//go:build go1.23 + package container import ( @@ -11,6 +14,7 @@ import ( "path" "path/filepath" "reflect" + "slices" "strings" "time" @@ -1130,10 +1134,8 @@ func validateLinuxPath(val string, validator func(string) bool) (string, error) // validateAttach validates that the specified string is a valid attach option. func validateAttach(val string) (string, error) { s := strings.ToLower(val) - for _, str := range []string{"stdin", "stdout", "stderr"} { - if s == str { - return s, nil - } + if slices.Contains([]string{"stdin", "stdout", "stderr"}, s) { + return s, nil } return val, errors.New("valid streams are STDIN, STDOUT and STDERR") }