mirror of
https://github.com/restic/restic.git
synced 2026-08-20 12:33:21 +00:00
Replace most usages of ioutil with the underlying function
The ioutil functions are deprecated since Go 1.17 and only wrap another library function. Thus directly call the underlying function. This commit only mechanically replaces the function calls.
This commit is contained in:
@@ -4,7 +4,7 @@ package textfile
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"golang.org/x/text/encoding/unicode"
|
||||
)
|
||||
@@ -34,7 +34,7 @@ func Decode(data []byte) ([]byte, error) {
|
||||
|
||||
// Read returns the contents of the file, converted to UTF-8, stripped of any BOM.
|
||||
func Read(filename string) ([]byte, error) {
|
||||
data, err := ioutil.ReadFile(filename)
|
||||
data, err := os.ReadFile(filename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package textfile
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/hex"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
@@ -13,7 +12,7 @@ import (
|
||||
func writeTempfile(t testing.TB, data []byte) (string, func()) {
|
||||
t.Helper()
|
||||
|
||||
f, err := ioutil.TempFile("", "restic-test-textfile-read-")
|
||||
f, err := os.CreateTemp("", "restic-test-textfile-read-")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user