From 8f5df19b353e02ffba842fd1b15ccf93da7ee3b4 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Mon, 7 Jul 2025 19:54:48 +0200 Subject: Fix a bunch of staticcheck errors Tool-assisted. --- internal/syscallcompat/asuser_linux.go | 4 ++-- internal/syscallcompat/getdents_test.go | 5 ++--- internal/syscallcompat/main_test.go | 3 +-- 3 files changed, 5 insertions(+), 7 deletions(-) (limited to 'internal/syscallcompat') diff --git a/internal/syscallcompat/asuser_linux.go b/internal/syscallcompat/asuser_linux.go index 804a898..39e3ff2 100644 --- a/internal/syscallcompat/asuser_linux.go +++ b/internal/syscallcompat/asuser_linux.go @@ -2,7 +2,7 @@ package syscallcompat import ( "fmt" - "io/ioutil" + "os" "runtime" "strconv" "strings" @@ -55,7 +55,7 @@ func asUser(f func() (int, error), context *fuse.Context) (int, error) { func getSupplementaryGroups(pid uint32) (gids []int) { procPath := fmt.Sprintf("/proc/%d/task/%d/status", pid, pid) - blob, err := ioutil.ReadFile(procPath) + blob, err := os.ReadFile(procPath) if err != nil { return nil } diff --git a/internal/syscallcompat/getdents_test.go b/internal/syscallcompat/getdents_test.go index eb670d6..c9e6a99 100644 --- a/internal/syscallcompat/getdents_test.go +++ b/internal/syscallcompat/getdents_test.go @@ -4,7 +4,6 @@ package syscallcompat import ( - "io/ioutil" "os" "runtime" "strings" @@ -49,13 +48,13 @@ func testGetdents(t *testing.T) { getdentsUnderTest = emulateGetdents } // Fill a directory with filenames of length 1 ... 255 - testDir, err := ioutil.TempDir(tmpDir, "TestGetdents") + testDir, err := os.MkdirTemp(tmpDir, "TestGetdents") if err != nil { t.Fatal(err) } for i := 1; i <= unix.NAME_MAX; i++ { n := strings.Repeat("x", i) - err = ioutil.WriteFile(testDir+"/"+n, nil, 0600) + err = os.WriteFile(testDir+"/"+n, nil, 0600) if err != nil { t.Fatal(err) } diff --git a/internal/syscallcompat/main_test.go b/internal/syscallcompat/main_test.go index ddf6bc4..7183f5a 100644 --- a/internal/syscallcompat/main_test.go +++ b/internal/syscallcompat/main_test.go @@ -2,7 +2,6 @@ package syscallcompat import ( "fmt" - "io/ioutil" "os" "testing" ) @@ -23,7 +22,7 @@ func TestMain(m *testing.M) { fmt.Println(err) os.Exit(1) } - tmpDir, err = ioutil.TempDir(parent, "syscallcompat") + tmpDir, err = os.MkdirTemp(parent, "syscallcompat") if err != nil { fmt.Println(err) os.Exit(1) -- cgit v1.2.3