Address ioutil deprecation

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar 2023-08-25 16:12:54 +02:00
parent 73749285d5
commit 2fad708556
2 changed files with 3 additions and 4 deletions

View File

@ -3,7 +3,7 @@ package main
import ( import (
"bytes" "bytes"
"encoding/json" "encoding/json"
"io/ioutil" "io"
"log" "log"
"os" "os"
"os/exec" "os/exec"
@ -188,7 +188,7 @@ func (c testConfig) getRuntimeSpec() (specs.Spec, error) {
} }
defer jsonFile.Close() defer jsonFile.Close()
jsonContent, err := ioutil.ReadAll(jsonFile) jsonContent, err := io.ReadAll(jsonFile)
if err != nil { if err != nil {
return spec, err return spec, err
} else if json.Valid(jsonContent) { } else if json.Valid(jsonContent) {

View File

@ -20,7 +20,6 @@ import (
"bytes" "bytes"
"encoding/json" "encoding/json"
"fmt" "fmt"
"io/ioutil"
"os" "os"
"github.com/NVIDIA/nvidia-container-toolkit/internal/logger" "github.com/NVIDIA/nvidia-container-toolkit/internal/logger"
@ -72,7 +71,7 @@ func (b *builder) loadConfig(config string) (*Config, error) {
} }
b.logger.Infof("Loading config from %v", config) b.logger.Infof("Loading config from %v", config)
readBytes, err := ioutil.ReadFile(config) readBytes, err := os.ReadFile(config)
if err != nil { if err != nil {
return nil, fmt.Errorf("unable to read config: %v", err) return nil, fmt.Errorf("unable to read config: %v", err)
} }