From 9970e24f21dbf47c9870fa8d643972bbe54ea73b Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Thu, 19 Jan 2023 17:15:17 +0100 Subject: [PATCH] Replaced deprecated calls (from go linter) --- legacy/builder/test/builder_utils_test.go | 4 ++-- legacy/builder/test/helper_tools_downloader.go | 5 ++--- legacy/builder/test/read_file_and_store_in_context_test.go | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/legacy/builder/test/builder_utils_test.go b/legacy/builder/test/builder_utils_test.go index d3c8e5a360e..b20e7e2555a 100644 --- a/legacy/builder/test/builder_utils_test.go +++ b/legacy/builder/test/builder_utils_test.go @@ -16,7 +16,7 @@ package test import ( - "io/ioutil" + "os" "testing" "time" @@ -32,7 +32,7 @@ func sleep(t *testing.T) { } func tempFile(t *testing.T, prefix string) *paths.Path { - file, err := ioutil.TempFile("", prefix) + file, err := os.CreateTemp("", prefix) file.Close() NoError(t, err) return paths.New(file.Name()) diff --git a/legacy/builder/test/helper_tools_downloader.go b/legacy/builder/test/helper_tools_downloader.go index a4be3843655..6e79e4d3aac 100644 --- a/legacy/builder/test/helper_tools_downloader.go +++ b/legacy/builder/test/helper_tools_downloader.go @@ -19,7 +19,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "net/http" "os" "os/exec" @@ -216,7 +215,7 @@ func downloadIndex(url string) (map[string]interface{}, error) { return nil, err } - bytes, err := ioutil.ReadAll(res.Body) + bytes, err := io.ReadAll(res.Body) if err != nil { return nil, err } @@ -632,7 +631,7 @@ func downloadAndUnpack(url string) (*paths.Path, []os.FileInfo, error) { return nil, nil, errors.WithStack(err) } - bytes, err := ioutil.ReadAll(res.Body) + bytes, err := io.ReadAll(res.Body) if err != nil { return nil, nil, errors.WithStack(err) } diff --git a/legacy/builder/test/read_file_and_store_in_context_test.go b/legacy/builder/test/read_file_and_store_in_context_test.go index c746c056d64..c4e299e2c60 100644 --- a/legacy/builder/test/read_file_and_store_in_context_test.go +++ b/legacy/builder/test/read_file_and_store_in_context_test.go @@ -16,7 +16,7 @@ package test import ( - "io/ioutil" + "os" "testing" "github.com/arduino/arduino-cli/legacy/builder" @@ -26,7 +26,7 @@ import ( ) func TestReadFileAndStoreInContext(t *testing.T) { - filePath, err := ioutil.TempFile("", "test") + filePath, err := os.CreateTemp("", "test") NoError(t, err) file := paths.New(filePath.Name())