Skip to content

Commit 7d93c02

Browse files
committed
cli/command/container: Simplify with slices.Contains
Signed-off-by: Paweł Gronowski <[email protected]>
1 parent 7a7075c commit 7d93c02

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

cli/command/container/opts.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
package container
44

55
import (
6+
"slices"
67
"bytes"
78
"encoding/json"
89
"errors"
@@ -1132,11 +1133,9 @@ func validateLinuxPath(val string, validator func(string) bool) (string, error)
11321133
// validateAttach validates that the specified string is a valid attach option.
11331134
func validateAttach(val string) (string, error) {
11341135
s := strings.ToLower(val)
1135-
for _, str := range []string{"stdin", "stdout", "stderr"} {
1136-
if s == str {
1136+
if slices.Contains([]string{"stdin", "stdout", "stderr"}, s) {
11371137
return s, nil
11381138
}
1139-
}
11401139
return val, errors.New("valid streams are STDIN, STDOUT and STDERR")
11411140
}
11421141

0 commit comments

Comments
 (0)