Skip to content

Commit c5532c0

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

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
@@ -14,6 +14,7 @@ import (
1414
"path"
1515
"path/filepath"
1616
"reflect"
17+
"slices"
1718
"strings"
1819
"time"
1920

@@ -1133,11 +1134,9 @@ func validateLinuxPath(val string, validator func(string) bool) (string, error)
11331134
// validateAttach validates that the specified string is a valid attach option.
11341135
func validateAttach(val string) (string, error) {
11351136
s := strings.ToLower(val)
1136-
for _, str := range []string{"stdin", "stdout", "stderr"} {
1137-
if s == str {
1137+
if slices.Contains([]string{"stdin", "stdout", "stderr"}, s) {
11381138
return s, nil
11391139
}
1140-
}
11411140
return val, errors.New("valid streams are STDIN, STDOUT and STDERR")
11421141
}
11431142

0 commit comments

Comments
 (0)