Skip to content

Commit 171a9b7

Browse files
authored
Merge pull request #6564 from vvoland/container-go123
cli/command/container: add go1.23 build constraint for range-over-func
2 parents bc2aa4e + 5ba4c17 commit 171a9b7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

cli/command/container/opts.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// FIXME(vvoland): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16:
2+
//go:build go1.23
3+
14
package container
25

36
import (
@@ -11,6 +14,7 @@ import (
1114
"path"
1215
"path/filepath"
1316
"reflect"
17+
"slices"
1418
"strings"
1519
"time"
1620

@@ -1130,10 +1134,8 @@ func validateLinuxPath(val string, validator func(string) bool) (string, error)
11301134
// validateAttach validates that the specified string is a valid attach option.
11311135
func validateAttach(val string) (string, error) {
11321136
s := strings.ToLower(val)
1133-
for _, str := range []string{"stdin", "stdout", "stderr"} {
1134-
if s == str {
1135-
return s, nil
1136-
}
1137+
if slices.Contains([]string{"stdin", "stdout", "stderr"}, s) {
1138+
return s, nil
11371139
}
11381140
return val, errors.New("valid streams are STDIN, STDOUT and STDERR")
11391141
}

0 commit comments

Comments
 (0)