all: simplify code by using modern Go constructs

Generated using modernize by running:

    go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -fix -test ./...

Change-Id: Ifc7d61cf6735cc53f2bdf890a338961f55075af5
Reviewed-on: https://go-review.googlesource.com/c/sys/+/661975
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
This commit is contained in:
Tobias Klauser
2025-04-03 13:04:48 -07:00
committed by Gopher Robot
parent 1b2bd6bb49
commit 01aaa8342f
8 changed files with 33 additions and 54 deletions
+3 -14
View File
@@ -10,6 +10,7 @@ import (
"os"
"path/filepath"
"runtime"
"slices"
"strings"
"testing"
@@ -62,13 +63,7 @@ func TestXattr(t *testing.T) {
// name and Listxattr doesn't return the namespace prefix.
xattrWant = strings.TrimPrefix(xattrWant, "user.")
}
found := false
for _, name := range xattrs {
if name == xattrWant {
found = true
break
}
}
found := slices.Contains(xattrs, xattrWant)
if !found {
t.Errorf("Listxattr did not return previously set attribute %q in attributes %v", xattrName, xattrs)
@@ -170,13 +165,7 @@ func TestFdXattr(t *testing.T) {
// name and Listxattr doesn't return the namespace prefix.
xattrWant = strings.TrimPrefix(xattrWant, "user.")
}
found := false
for _, name := range xattrs {
if name == xattrWant {
found = true
break
}
}
found := slices.Contains(xattrs, xattrWant)
if !found {
t.Errorf("Flistxattr did not return previously set attribute %q in attributes %v", xattrName, xattrs)