diff --git a/AUTHORS b/AUTHORS index 2213fe1..4aa7b97 100644 --- a/AUTHORS +++ b/AUTHORS @@ -10,11 +10,12 @@ Artyom Pervukhin Dan Peterson +David Walton Davsk Ltd Co Jaap Aarts Jan Mercl <0xjnml@gmail.com> Logan Snow Michael Hoffmann Ross Light -Steffen Butzer Saed SayedAhmed +Steffen Butzer diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 97b4d84..f383ce5 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -10,6 +10,7 @@ Alexander Menzhinsky Artyom Pervukhin Dan Peterson David Skinner +David Walton Gleb Sakhnov Jaap Aarts Jan Mercl <0xjnml@gmail.com> @@ -17,6 +18,6 @@ Logan Snow Matthew Gabeler-Lee Michael Hoffmann Ross Light +Saed SayedAhmed Steffen Butzer Yaacov Akiba Slama -Saed SayedAhmed diff --git a/all_test.go b/all_test.go index 2b10696..50c0310 100644 --- a/all_test.go +++ b/all_test.go @@ -13,7 +13,6 @@ import ( "errors" "flag" "fmt" - "io/ioutil" "math/rand" "net/url" "os" @@ -126,7 +125,7 @@ func TestMain(m *testing.M) { func testMain(m *testing.M) int { var err error - tempDir, err = ioutil.TempDir("", "sqlite-test-") + tempDir, err = os.MkdirTemp("", "sqlite-test-") if err != nil { panic(err) //TODOOK } @@ -137,7 +136,7 @@ func testMain(m *testing.M) int { } func tempDB(t testing.TB) (string, *sql.DB) { - dir, err := ioutil.TempDir("", "sqlite-test-") + dir, err := os.MkdirTemp("", "sqlite-test-") if err != nil { t.Fatal(err) } @@ -778,7 +777,7 @@ func TestConcurrentGoroutines(t *testing.T) { nrows = 5000 ) - dir, err := ioutil.TempDir("", "sqlite-test-") + dir, err := os.MkdirTemp("", "sqlite-test-") if err != nil { t.Fatal(err) } @@ -890,7 +889,7 @@ func TestConcurrentProcesses(t *testing.T) { t.Skip("skipping test") } - dir, err := ioutil.TempDir("", "sqlite-test-") + dir, err := os.MkdirTemp("", "sqlite-test-") if err != nil { t.Fatal(err) } @@ -909,7 +908,7 @@ func TestConcurrentProcesses(t *testing.T) { continue } - b, err := ioutil.ReadFile(v) + b, err := os.ReadFile(v) if err != nil { t.Fatal(err) } @@ -922,7 +921,7 @@ func TestConcurrentProcesses(t *testing.T) { b = bytes.ReplaceAll(b, []byte("\r\n"), []byte("\n")) } - if err := ioutil.WriteFile(filepath.Join(dir, filepath.Base(v)), b, 0666); err != nil { + if err := os.WriteFile(filepath.Join(dir, filepath.Base(v)), b, 0666); err != nil { t.Fatal(err) } } @@ -1026,7 +1025,7 @@ INSERT INTO "products" ("id", "user_id", "name", "description", "created_at", "c ` ) - dir, err := ioutil.TempDir("", "sqlite-test-") + dir, err := os.MkdirTemp("", "sqlite-test-") if err != nil { t.Fatal(err) } @@ -1124,7 +1123,7 @@ func mustExec(t *testing.T, db *sql.DB, sql string, args ...interface{}) sql.Res func TestIssue20(t *testing.T) { const TablePrefix = "gosqltest_" - tempDir, err := ioutil.TempDir("", "") + tempDir, err := os.MkdirTemp("", "") if err != nil { t.Fatal(err) } @@ -1184,7 +1183,7 @@ func TestIssue20(t *testing.T) { } func TestNoRows(t *testing.T) { - tempDir, err := ioutil.TempDir("", "") + tempDir, err := os.MkdirTemp("", "") if err != nil { t.Fatal(err) } @@ -1277,7 +1276,7 @@ func TestColumnsNoRows(t *testing.T) { // https://gitlab.com/cznic/sqlite/-/issues/28 func TestIssue28(t *testing.T) { - tempDir, err := ioutil.TempDir("", "") + tempDir, err := os.MkdirTemp("", "") if err != nil { t.Fatal(err) } @@ -1306,7 +1305,7 @@ func TestIssue28(t *testing.T) { // https://gitlab.com/cznic/sqlite/-/issues/30 func TestColumnTypes(t *testing.T) { - tempDir, err := ioutil.TempDir("", "") + tempDir, err := os.MkdirTemp("", "") if err != nil { t.Fatal(err) } @@ -1375,7 +1374,7 @@ Col 3: DatabaseTypeName "DATE", DecimalSize 0 0 false, Length 922337203685477580 // https://gitlab.com/cznic/sqlite/-/issues/32 func TestColumnTypesNoRows(t *testing.T) { - tempDir, err := ioutil.TempDir("", "") + tempDir, err := os.MkdirTemp("", "") if err != nil { t.Fatal(err) } @@ -1803,7 +1802,7 @@ func TestIssue51(t *testing.T) { t.Skip("skipping test in short mode") } - tempDir, err := ioutil.TempDir("", "") + tempDir, err := os.MkdirTemp("", "") if err != nil { t.Fatal(err) } @@ -1942,7 +1941,7 @@ const charset = "abcdefghijklmnopqrstuvwxyz" + // https://gitlab.com/cznic/sqlite/-/issues/53 func TestIssue53(t *testing.T) { - tempDir, err := ioutil.TempDir("", "") + tempDir, err := os.MkdirTemp("", "") if err != nil { t.Fatal(err) } @@ -1999,7 +1998,7 @@ CREATE TABLE IF NOT EXISTS loginst ( // https://gitlab.com/cznic/sqlite/-/issues/37 func TestPersistPragma(t *testing.T) { - tempDir, err := ioutil.TempDir("", "") + tempDir, err := os.MkdirTemp("", "") if err != nil { t.Fatal(err) } @@ -2100,7 +2099,7 @@ func checkPragmas(db *sql.DB, pragmas []pragmaCfg) error { } func TestInMemory(t *testing.T) { - tempDir, err := ioutil.TempDir("", "") + tempDir, err := os.MkdirTemp("", "") if err != nil { t.Fatal(err) } @@ -2154,13 +2153,13 @@ func testInMemory(db *sql.DB) error { return err } - files, err := ioutil.ReadDir("./") + dirEntries, err := os.ReadDir("./") if err != nil { return err } - for _, file := range files { - if strings.Contains(file.Name(), "memory") { + for _, dirEntry := range dirEntries { + if strings.Contains(dirEntry.Name(), "memory") { return fmt.Errorf("file was created for in memory database") } } @@ -2225,7 +2224,7 @@ func TestIssue70(t *testing.T) { // https://gitlab.com/cznic/sqlite/-/issues/66 func TestIssue66(t *testing.T) { - tempDir, err := ioutil.TempDir("", "") + tempDir, err := os.MkdirTemp("", "") if err != nil { t.Fatal(err) } @@ -2289,7 +2288,7 @@ func TestIssue66(t *testing.T) { // https://gitlab.com/cznic/sqlite/-/issues/65 func TestIssue65(t *testing.T) { - tempDir, err := ioutil.TempDir("", "") + tempDir, err := os.MkdirTemp("", "") if err != nil { t.Fatal(err) } @@ -2469,7 +2468,7 @@ func TestConstraintUniqueError(t *testing.T) { // https://gitlab.com/cznic/sqlite/-/issues/92 func TestBeginMode(t *testing.T) { - tempDir, err := ioutil.TempDir("", "") + tempDir, err := os.MkdirTemp("", "") if err != nil { t.Fatal(err) } @@ -2535,7 +2534,7 @@ func TestBeginMode(t *testing.T) { // https://gitlab.com/cznic/sqlite/-/issues/94 func TestCancelRace(t *testing.T) { - tempDir, err := ioutil.TempDir("", "") + tempDir, err := os.MkdirTemp("", "") if err != nil { t.Fatal(err) } diff --git a/cgo_test.go b/cgo_test.go index fafa45a..0700afb 100644 --- a/cgo_test.go +++ b/cgo_test.go @@ -6,9 +6,9 @@ // +build ignore cgo,cgotest package sqlite // import "modernc.org/sqlite" + import ( "database/sql" - "io/ioutil" "os" "path/filepath" "testing" @@ -18,7 +18,7 @@ import ( // https://gitlab.com/cznic/sqlite/-/issues/65 func TestIssue65CGo(t *testing.T) { - tempDir, err := ioutil.TempDir("", "") + tempDir, err := os.MkdirTemp("", "") if err != nil { t.Fatal(err) } diff --git a/examples/example1/main.go b/examples/example1/main.go index 37c7f61..14593a1 100644 --- a/examples/example1/main.go +++ b/examples/example1/main.go @@ -3,7 +3,6 @@ package main import ( "database/sql" "fmt" - "io/ioutil" "os" "path/filepath" @@ -18,7 +17,7 @@ func main() { } func main1() error { - dir, err := ioutil.TempDir("", "test-") + dir, err := os.MkdirTemp("", "test-") if err != nil { return err } diff --git a/generator.go b/generator.go index 252a32f..27b1e46 100644 --- a/generator.go +++ b/generator.go @@ -13,7 +13,6 @@ import ( "flag" "fmt" "io" - "io/ioutil" "net/http" "os" "os/exec" @@ -263,7 +262,7 @@ var ( ) func download() { - tmp, err := ioutil.TempDir("", "") + tmp, err := os.MkdirTemp("", "") if err != nil { fmt.Fprintf(os.Stderr, "%s\n", err) return diff --git a/tcl_test.go b/tcl_test.go index 7864237..035cea8 100644 --- a/tcl_test.go +++ b/tcl_test.go @@ -8,7 +8,6 @@ import ( "bytes" "flag" "fmt" - "io/ioutil" "os" "os/exec" "path/filepath" @@ -57,7 +56,7 @@ func TestTclTest(t *testing.T) { t.Fatal(err) } - dir, err := ioutil.TempDir("", "sqlite-test-") + dir, err := os.MkdirTemp("", "sqlite-test-") if err != nil { t.Fatal(err) } @@ -99,12 +98,12 @@ func TestTclTest(t *testing.T) { s := filepath.Join(wd, v) d := filepath.Join(dir, filepath.Base(v)) - f, err := ioutil.ReadFile(s) + f, err := os.ReadFile(s) if err != nil { t.Fatal(err) } - if err := ioutil.WriteFile(d, f, 0660); err != nil { + if err := os.WriteFile(d, f, 0660); err != nil { t.Fatal(err) } } diff --git a/tpch/dbgen.go b/tpch/dbgen.go index 8169e55..edce760 100644 --- a/tpch/dbgen.go +++ b/tpch/dbgen.go @@ -8,7 +8,6 @@ import ( "bufio" "database/sql" "fmt" - "io/ioutil" "math" "math/big" "os" @@ -628,7 +627,7 @@ func pthForSUT(sut driver.SUT, sf int) string { } func dbGen(sut driver.SUT, sf int) (err error) { - if pseudotext, err = ioutil.ReadFile(filepath.Join("testdata", "pseudotext")); err != nil { + if pseudotext, err = os.ReadFile(filepath.Join("testdata", "pseudotext")); err != nil { return fmt.Errorf("Run this program with -pseudotext: %v", err) }