Skip to content

Commit

Permalink
replace ioutil.WriteFile with os.WriteFile
Browse files Browse the repository at this point in the history
  • Loading branch information
stefafafan committed Nov 17, 2022
1 parent e14a9f9 commit 53fcc42
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 12 deletions.
3 changes: 1 addition & 2 deletions boilingcore/output.go
Expand Up @@ -5,7 +5,6 @@ import (
"bytes"
"fmt"
"go/format"
"io/ioutil"
"os"
"path/filepath"
"regexp"
Expand Down Expand Up @@ -42,7 +41,7 @@ var (
rgxRemoveNumberedPrefix = regexp.MustCompile(`^[0-9]+_`)
rgxSyntaxError = regexp.MustCompile(`(\d+):\d+: `)

testHarnessWriteFile = ioutil.WriteFile
testHarnessWriteFile = os.WriteFile
)

type executeTemplateData struct {
Expand Down
3 changes: 1 addition & 2 deletions drivers/sqlboiler-mssql/driver/mssql_test.go
Expand Up @@ -26,7 +26,6 @@ import (
"bytes"
"encoding/json"
"flag"
"io/ioutil"
"os"
"os/exec"
"regexp"
Expand Down Expand Up @@ -92,7 +91,7 @@ func TestDriver(t *testing.T) {
}

if *flagOverwriteGolden {
if err = ioutil.WriteFile("mssql.golden.json", got, 0664); err != nil {
if err = os.WriteFile("mssql.golden.json", got, 0664); err != nil {
t.Fatal(err)
}
t.Log("wrote:", string(got))
Expand Down
3 changes: 1 addition & 2 deletions drivers/sqlboiler-mysql/driver/mysql_test.go
Expand Up @@ -14,7 +14,6 @@ import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"os"
"os/exec"
"testing"
Expand Down Expand Up @@ -99,7 +98,7 @@ func TestDriver(t *testing.T) {
}

if *flagOverwriteGolden {
if err = ioutil.WriteFile(tt.goldenJson, got, 0664); err != nil {
if err = os.WriteFile(tt.goldenJson, got, 0664); err != nil {
t.Fatal(err)
}
t.Log("wrote:", string(got))
Expand Down
3 changes: 1 addition & 2 deletions drivers/sqlboiler-psql/driver/psql_test.go
Expand Up @@ -13,7 +13,6 @@ import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"os"
"os/exec"
"testing"
Expand Down Expand Up @@ -100,7 +99,7 @@ func TestAssemble(t *testing.T) {
}

if *flagOverwriteGolden {
if err = ioutil.WriteFile(tt.goldenJson, got, 0664); err != nil {
if err = os.WriteFile(tt.goldenJson, got, 0664); err != nil {
t.Fatal(err)
}
t.Log("wrote:", string(got))
Expand Down
3 changes: 1 addition & 2 deletions drivers/sqlboiler-sqlite3/driver/sqlite3_test.go
Expand Up @@ -5,7 +5,6 @@ import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"math/rand"
"os"
"os/exec"
Expand Down Expand Up @@ -72,7 +71,7 @@ func TestDriver(t *testing.T) {
}

if *flagOverwriteGolden {
if err = ioutil.WriteFile(tt.goldenJson, got, 0664); err != nil {
if err = os.WriteFile(tt.goldenJson, got, 0664); err != nil {
t.Fatal(err)
}
t.Log("wrote:", string(got))
Expand Down
3 changes: 1 addition & 2 deletions queries/query_builders_test.go
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"flag"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"reflect"
Expand Down Expand Up @@ -139,7 +138,7 @@ func TestBuildQuery(t *testing.T) {
out, args := BuildQuery(test.q)

if *writeGoldenFiles {
err := ioutil.WriteFile(filename, []byte(out), 0664)
err := os.WriteFile(filename, []byte(out), 0664)
if err != nil {
t.Fatalf("Failed to write golden file %s: %s\n", filename, err)
}
Expand Down

0 comments on commit 53fcc42

Please sign in to comment.