From 02875cef9010633b6689cfd1e2ceec9107b756b4 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sun, 4 Dec 2022 13:27:43 -0800 Subject: Stop using deprecated package io/ioutil Since Go 1.16 (which recently became the minimum supported Go version for this project), the package io/ioutil is deprecated in favor of equivalent functionality in the io and os packages. staticcheck warns about this. Address all the warnings by switching to the non-deprecated replacement functions. --- filesystem/mountpoint_test.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'filesystem/mountpoint_test.go') diff --git a/filesystem/mountpoint_test.go b/filesystem/mountpoint_test.go index 99d4b55..43b5a0d 100644 --- a/filesystem/mountpoint_test.go +++ b/filesystem/mountpoint_test.go @@ -26,7 +26,6 @@ package filesystem import ( "fmt" - "io/ioutil" "os" "path/filepath" "strings" @@ -122,7 +121,7 @@ func TestLoadSourceDevice(t *testing.T) { func TestNondirectoryMountsIgnored(t *testing.T) { beginLoadMountInfoTest() defer endLoadMountInfoTest() - file, err := ioutil.TempFile("", "fscrypt_regfile") + file, err := os.CreateTemp("", "fscrypt_regfile") if err != nil { t.Fatal(err) } @@ -155,7 +154,7 @@ func TestNonLatestMountsIgnored(t *testing.T) { // Test that escape sequences in the mountinfo file are unescaped correctly. func TestLoadMountWithSpecialCharacters(t *testing.T) { - tempDir, err := ioutil.TempDir("", "fscrypt") + tempDir, err := os.MkdirTemp("", "fscrypt") if err != nil { t.Fatal(err) } @@ -296,7 +295,7 @@ func TestRootMountpointIsPreferred(t *testing.T) { // Test that a mountpoint that is not "/" but still contains all other // mountpoints is preferred, given independent subtrees. func TestHighestMountpointIsPreferred(t *testing.T) { - tempDir, err := ioutil.TempDir("", "fscrypt") + tempDir, err := os.MkdirTemp("", "fscrypt") if err != nil { t.Fatal(err) } @@ -331,7 +330,7 @@ func TestHighestMountpointIsPreferred(t *testing.T) { // mountpoints are contained in other mountpoints, the chosen Mount is the root // of a tree of mountpoints whose mounted subtrees contain all mounted subtrees. func TestLoadContainedSubtreesAndMountpoints(t *testing.T) { - tempDir, err := ioutil.TempDir("", "fscrypt") + tempDir, err := os.MkdirTemp("", "fscrypt") if err != nil { t.Fatal(err) } -- cgit v1.3