deps: Update ioutil deprecated library references to os and io respectively in the client package (#16318)

* Update ioutil deprecated library references to os and io respectively

* Deal with the errors produced.

Add error handling to filEntry info
Add error handling to info
This commit is contained in:
Lance Haig
2023-03-08 20:25:10 +01:00
committed by GitHub
parent 3160c76209
commit 48e7d70fcd
34 changed files with 112 additions and 127 deletions

View File

@@ -2,7 +2,6 @@ package allocdir
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
@@ -184,12 +183,16 @@ func (t *TaskDir) embedDirs(entries map[string]string) error {
}
// Enumerate the files in source.
dirEntries, err := ioutil.ReadDir(source)
dirEntries, err := os.ReadDir(source)
if err != nil {
return fmt.Errorf("Couldn't read directory %v: %v", source, err)
}
for _, entry := range dirEntries {
for _, fileEntry := range dirEntries {
entry, err := fileEntry.Info()
if err != nil {
return fmt.Errorf("Couldn't read the file information %v: %v", entry, err)
}
hostEntry := filepath.Join(source, entry.Name())
taskEntry := filepath.Join(destDir, filepath.Base(hostEntry))
if entry.IsDir() {