Use for range over integers

This appears in Go 1.22 (see https://tip.golang.org/ref/spec#For_range).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin
2025-03-28 18:52:42 -07:00
parent f64edc4d6d
commit 17570625c0
9 changed files with 12 additions and 12 deletions
+2 -2
View File
@@ -878,7 +878,7 @@ func reOpenDevNull() error {
if err := unix.Fstat(int(file.Fd()), &devNullStat); err != nil {
return &os.PathError{Op: "fstat", Path: file.Name(), Err: err}
}
for fd := 0; fd < 3; fd++ {
for fd := range 3 {
if err := unix.Fstat(fd, &stat); err != nil {
return &os.PathError{Op: "fstat", Path: "fd " + strconv.Itoa(fd), Err: err}
}
@@ -1211,7 +1211,7 @@ func remountReadonly(m *configs.Mount) error {
dest = m.Destination
flags = m.Flags
)
for i := 0; i < 5; i++ {
for range 5 {
// There is a special case in the kernel for
// MS_REMOUNT | MS_BIND, which allows us to change only the
// flags even as an unprivileged user (i.e. user namespace)