Skip to content

Commit

Permalink
io/ioutil package is deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
furusax0621 committed Dec 24, 2022
1 parent f367684 commit e046f58
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions testutils/testutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"database/sql"
"encoding/json"
"fmt"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
Expand Down Expand Up @@ -156,7 +155,7 @@ func WriteFile(tb testing.TB, filename string, lines []string) {
func LoadQueriesFromFile(tb testing.TB, filename string) {
conn := GetMySQLConnection(tb)
file := filepath.Join("testdata", filename)
data, err := ioutil.ReadFile(file)
data, err := os.ReadFile(file)
if err != nil {
fmt.Printf("%s cannot load json file %q: %s\n\n", caller(), file, err)
tb.FailNow()
Expand All @@ -170,7 +169,7 @@ func LoadQueriesFromFile(tb testing.TB, filename string) {

func LoadJson(tb testing.TB, filename string, dest interface{}) {
file := filepath.Join("testdata", filename)
data, err := ioutil.ReadFile(file)
data, err := os.ReadFile(file)
if err != nil {
fmt.Printf("%s cannot load json file %q: %s\n\n", caller(), file, err)
}
Expand All @@ -188,7 +187,7 @@ func WriteJson(tb testing.TB, filename string, data interface{}) {
fmt.Printf("%s cannot marshal %T into %q: %s\n\n", caller(), data, file, err)
tb.FailNow()
}
err = ioutil.WriteFile(file, buf, os.ModePerm)
err = os.WriteFile(file, buf, os.ModePerm)
if err != nil {
fmt.Printf("%s cannot write file %q: %s\n\n", caller(), file, err)
tb.FailNow()
Expand Down

0 comments on commit e046f58

Please sign in to comment.