From 2fad708556cdb96279ab06e44ff068818f5ef60c Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Fri, 25 Aug 2023 16:12:54 +0200 Subject: [PATCH] Address ioutil deprecation Signed-off-by: Evan Lezar --- cmd/nvidia-container-runtime/main_test.go | 4 ++-- pkg/config/engine/docker/option.go | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/cmd/nvidia-container-runtime/main_test.go b/cmd/nvidia-container-runtime/main_test.go index 4260559b..dad9ac79 100644 --- a/cmd/nvidia-container-runtime/main_test.go +++ b/cmd/nvidia-container-runtime/main_test.go @@ -3,7 +3,7 @@ package main import ( "bytes" "encoding/json" - "io/ioutil" + "io" "log" "os" "os/exec" @@ -188,7 +188,7 @@ func (c testConfig) getRuntimeSpec() (specs.Spec, error) { } defer jsonFile.Close() - jsonContent, err := ioutil.ReadAll(jsonFile) + jsonContent, err := io.ReadAll(jsonFile) if err != nil { return spec, err } else if json.Valid(jsonContent) { diff --git a/pkg/config/engine/docker/option.go b/pkg/config/engine/docker/option.go index 4f64382f..dfb67499 100644 --- a/pkg/config/engine/docker/option.go +++ b/pkg/config/engine/docker/option.go @@ -20,7 +20,6 @@ import ( "bytes" "encoding/json" "fmt" - "io/ioutil" "os" "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) - readBytes, err := ioutil.ReadFile(config) + readBytes, err := os.ReadFile(config) if err != nil { return nil, fmt.Errorf("unable to read config: %v", err) }