Skip to content

Commit e046f58

Browse files
committed
io/ioutil package is deprecated
1 parent f367684 commit e046f58

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

testutils/testutils.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"database/sql"
66
"encoding/json"
77
"fmt"
8-
"io/ioutil"
98
"os"
109
"os/exec"
1110
"path/filepath"
@@ -156,7 +155,7 @@ func WriteFile(tb testing.TB, filename string, lines []string) {
156155
func LoadQueriesFromFile(tb testing.TB, filename string) {
157156
conn := GetMySQLConnection(tb)
158157
file := filepath.Join("testdata", filename)
159-
data, err := ioutil.ReadFile(file)
158+
data, err := os.ReadFile(file)
160159
if err != nil {
161160
fmt.Printf("%s cannot load json file %q: %s\n\n", caller(), file, err)
162161
tb.FailNow()
@@ -170,7 +169,7 @@ func LoadQueriesFromFile(tb testing.TB, filename string) {
170169

171170
func LoadJson(tb testing.TB, filename string, dest interface{}) {
172171
file := filepath.Join("testdata", filename)
173-
data, err := ioutil.ReadFile(file)
172+
data, err := os.ReadFile(file)
174173
if err != nil {
175174
fmt.Printf("%s cannot load json file %q: %s\n\n", caller(), file, err)
176175
}
@@ -188,7 +187,7 @@ func WriteJson(tb testing.TB, filename string, data interface{}) {
188187
fmt.Printf("%s cannot marshal %T into %q: %s\n\n", caller(), data, file, err)
189188
tb.FailNow()
190189
}
191-
err = ioutil.WriteFile(file, buf, os.ModePerm)
190+
err = os.WriteFile(file, buf, os.ModePerm)
192191
if err != nil {
193192
fmt.Printf("%s cannot write file %q: %s\n\n", caller(), file, err)
194193
tb.FailNow()

0 commit comments

Comments
 (0)