Skip to content

Commit 9970e24

Browse files
committed
Replaced deprecated calls (from go linter)
1 parent 137c531 commit 9970e24

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

legacy/builder/test/builder_utils_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
package test
1717

1818
import (
19-
"io/ioutil"
19+
"os"
2020
"testing"
2121
"time"
2222

@@ -32,7 +32,7 @@ func sleep(t *testing.T) {
3232
}
3333

3434
func tempFile(t *testing.T, prefix string) *paths.Path {
35-
file, err := ioutil.TempFile("", prefix)
35+
file, err := os.CreateTemp("", prefix)
3636
file.Close()
3737
NoError(t, err)
3838
return paths.New(file.Name())

legacy/builder/test/helper_tools_downloader.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import (
1919
"encoding/json"
2020
"fmt"
2121
"io"
22-
"io/ioutil"
2322
"net/http"
2423
"os"
2524
"os/exec"
@@ -216,7 +215,7 @@ func downloadIndex(url string) (map[string]interface{}, error) {
216215
return nil, err
217216
}
218217

219-
bytes, err := ioutil.ReadAll(res.Body)
218+
bytes, err := io.ReadAll(res.Body)
220219
if err != nil {
221220
return nil, err
222221
}
@@ -632,7 +631,7 @@ func downloadAndUnpack(url string) (*paths.Path, []os.FileInfo, error) {
632631
return nil, nil, errors.WithStack(err)
633632
}
634633

635-
bytes, err := ioutil.ReadAll(res.Body)
634+
bytes, err := io.ReadAll(res.Body)
636635
if err != nil {
637636
return nil, nil, errors.WithStack(err)
638637
}

legacy/builder/test/read_file_and_store_in_context_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
package test
1717

1818
import (
19-
"io/ioutil"
19+
"os"
2020
"testing"
2121

2222
"github.com/arduino/arduino-cli/legacy/builder"
@@ -26,7 +26,7 @@ import (
2626
)
2727

2828
func TestReadFileAndStoreInContext(t *testing.T) {
29-
filePath, err := ioutil.TempFile("", "test")
29+
filePath, err := os.CreateTemp("", "test")
3030
NoError(t, err)
3131

3232
file := paths.New(filePath.Name())

0 commit comments

Comments
 (0)