Skip to content

Commit

Permalink
Fix io/ioutil import
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Byrgazov <[email protected]>
  • Loading branch information
Vladislav Byrgazov committed Nov 12, 2024
1 parent d0bc190 commit b9a85d0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions pkg/kernel/link.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ package kernel

import (
"io/fs"
"io/ioutil"
"os"
"path/filepath"

Expand Down Expand Up @@ -215,7 +214,7 @@ func searchByPCIAddress(ns netns.NsHandle, _, pciAddress string) (netlink.Link,
}

var fInfos []fs.FileInfo
fInfos, err = ioutil.ReadDir(netDir)
fInfos, err = os.ReadDir(netDir)

Check failure on line 217 in pkg/kernel/link.go

View workflow job for this annotation

GitHub Actions / build-and-test / build-and-test (ubuntu-latest)

cannot use os.ReadDir(netDir) (value of type []fs.DirEntry) as []fs.FileInfo value in assignment
if err != nil {
return errors.Errorf("failed to read net directory %s: %q", netDir, err)
}
Expand Down Expand Up @@ -244,14 +243,14 @@ func findNetDir(basePath string) (string, error) {
if _, err := os.Lstat(subDir); err == nil {
return subDir, nil
}
files, err := ioutil.ReadDir(basePath)
files, err := os.ReadDir(basePath)
if err != nil {
return "", errors.Wrapf(err, "failed to read directory %s", basePath)
}
for _, file := range files {
if file.IsDir() {
subDir = filepath.Join(basePath, file.Name())
subdirFiles, err := ioutil.ReadDir(subDir)
subdirFiles, err := os.ReadDir(subDir)
if err != nil {
return "", errors.Wrapf(err, "failed to read subdirectory %s", subDir)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) 2021-2022 Nordix Foundation.
//
// Copyright (c) 2020-2023 Cisco and/or its affiliates.
// Copyright (c) 2020-2024 Cisco and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
Expand Down

0 comments on commit b9a85d0

Please sign in to comment.