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.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'filesystem/mountpoint.go') diff --git a/filesystem/mountpoint.go b/filesystem/mountpoint.go index 0b0693b..0abae06 100644 --- a/filesystem/mountpoint.go +++ b/filesystem/mountpoint.go @@ -25,7 +25,6 @@ import ( "bufio" "fmt" "io" - "io/ioutil" "log" "os" "path/filepath" @@ -537,11 +536,15 @@ func getMountFromLink(link string) (*Mount, error) { } func (mnt *Mount) getFilesystemUUID() (string, error) { - dirContents, err := ioutil.ReadDir(uuidDirectory) + dirEntries, err := os.ReadDir(uuidDirectory) if err != nil { return "", err } - for _, fileInfo := range dirContents { + for _, dirEntry := range dirEntries { + fileInfo, err := dirEntry.Info() + if err != nil { + continue + } if fileInfo.Mode()&os.ModeSymlink == 0 { continue // Only interested in UUID symlinks } -- cgit v1.2.3