From ace01b29273b8d9527cbcf38a76fc56b09eb7bc3 Mon Sep 17 00:00:00 2001 From: Nuno Cruces Date: Fri, 18 Oct 2024 12:20:32 +0100 Subject: [PATCH] Split local imports. --- config.go | 3 ++- conn.go | 3 ++- ext/bloom/bloom.go | 1 + ext/hash/hash_test.go | 9 +++++---- ext/stats/percentile.go | 3 ++- ext/unicode/unicode.go | 5 +++-- ext/uuid/uuid.go | 1 + ext/uuid/uuid_test.go | 1 + func.go | 3 ++- gormlite/error_translator.go | 3 ++- gormlite/error_translator_test.go | 3 ++- internal/testcfg/testcfg.go | 3 ++- internal/util/module.go | 3 ++- sqlite.go | 5 +++-- tests/json_test.go | 3 ++- time.go | 3 ++- txn.go | 3 ++- util/vtabutil/parse.go | 3 ++- vfs/adiantum/api.go | 3 ++- vfs/adiantum/example_test.go | 7 ++++--- vfs/adiantum/hbsh.go | 3 ++- vfs/filename.go | 3 ++- vfs/lock_test.go | 3 ++- vfs/readervfs/example_test.go | 3 ++- vfs/shm.go | 3 ++- vfs/shm_bsd.go | 3 ++- vfs/tests/mptest/mptest_test.go | 9 +++++---- vfs/vfs.go | 5 +++-- vfs/vfs_test.go | 3 ++- vfs/xts/api.go | 3 ++- vtab.go | 3 ++- 31 files changed, 70 insertions(+), 39 deletions(-) diff --git a/config.go b/config.go index 6876ba5..7f6bd85 100644 --- a/config.go +++ b/config.go @@ -3,9 +3,10 @@ package sqlite3 import ( "context" + "github.com/tetratelabs/wazero/api" + "github.com/ncruces/go-sqlite3/internal/util" "github.com/ncruces/go-sqlite3/vfs" - "github.com/tetratelabs/wazero/api" ) // Config makes configuration changes to a database connection. diff --git a/conn.go b/conn.go index dbe9b6b..7635e58 100644 --- a/conn.go +++ b/conn.go @@ -8,9 +8,10 @@ import ( "strings" "time" + "github.com/tetratelabs/wazero/api" + "github.com/ncruces/go-sqlite3/internal/util" "github.com/ncruces/go-sqlite3/vfs" - "github.com/tetratelabs/wazero/api" ) // Conn is a database connection handle. diff --git a/ext/bloom/bloom.go b/ext/bloom/bloom.go index e807bf9..3fcc73b 100644 --- a/ext/bloom/bloom.go +++ b/ext/bloom/bloom.go @@ -13,6 +13,7 @@ import ( "strconv" "github.com/dchest/siphash" + "github.com/ncruces/go-sqlite3" "github.com/ncruces/go-sqlite3/internal/util" ) diff --git a/ext/hash/hash_test.go b/ext/hash/hash_test.go index cc274bb..96f6614 100644 --- a/ext/hash/hash_test.go +++ b/ext/hash/hash_test.go @@ -7,15 +7,16 @@ import ( _ "crypto/sha512" "testing" - "github.com/ncruces/go-sqlite3/driver" - _ "github.com/ncruces/go-sqlite3/embed" - _ "github.com/ncruces/go-sqlite3/internal/testcfg" - "github.com/ncruces/go-sqlite3/vfs/memdb" _ "golang.org/x/crypto/blake2b" _ "golang.org/x/crypto/blake2s" _ "golang.org/x/crypto/md4" _ "golang.org/x/crypto/ripemd160" _ "golang.org/x/crypto/sha3" + + "github.com/ncruces/go-sqlite3/driver" + _ "github.com/ncruces/go-sqlite3/embed" + _ "github.com/ncruces/go-sqlite3/internal/testcfg" + "github.com/ncruces/go-sqlite3/vfs/memdb" ) func TestRegister(t *testing.T) { diff --git a/ext/stats/percentile.go b/ext/stats/percentile.go index 2999b56..fdf353f 100644 --- a/ext/stats/percentile.go +++ b/ext/stats/percentile.go @@ -6,9 +6,10 @@ import ( "math" "slices" + "github.com/ncruces/sort/quick" + "github.com/ncruces/go-sqlite3" "github.com/ncruces/go-sqlite3/internal/util" - "github.com/ncruces/sort/quick" ) const ( diff --git a/ext/unicode/unicode.go b/ext/unicode/unicode.go index 3620cee..31c22b5 100644 --- a/ext/unicode/unicode.go +++ b/ext/unicode/unicode.go @@ -28,14 +28,15 @@ import ( "unicode" "unicode/utf8" - "github.com/ncruces/go-sqlite3" - "github.com/ncruces/go-sqlite3/internal/util" "golang.org/x/text/cases" "golang.org/x/text/collate" "golang.org/x/text/language" "golang.org/x/text/runes" "golang.org/x/text/transform" "golang.org/x/text/unicode/norm" + + "github.com/ncruces/go-sqlite3" + "github.com/ncruces/go-sqlite3/internal/util" ) // Set RegisterLike to false to not register a Unicode aware LIKE operator. diff --git a/ext/uuid/uuid.go b/ext/uuid/uuid.go index 2febdef..4111cbd 100644 --- a/ext/uuid/uuid.go +++ b/ext/uuid/uuid.go @@ -9,6 +9,7 @@ import ( "fmt" "github.com/google/uuid" + "github.com/ncruces/go-sqlite3" "github.com/ncruces/go-sqlite3/internal/util" ) diff --git a/ext/uuid/uuid_test.go b/ext/uuid/uuid_test.go index 92e5e2a..acb0499 100644 --- a/ext/uuid/uuid_test.go +++ b/ext/uuid/uuid_test.go @@ -4,6 +4,7 @@ import ( "testing" "github.com/google/uuid" + "github.com/ncruces/go-sqlite3/driver" _ "github.com/ncruces/go-sqlite3/embed" _ "github.com/ncruces/go-sqlite3/internal/testcfg" diff --git a/func.go b/func.go index 7ff740d..621c095 100644 --- a/func.go +++ b/func.go @@ -4,8 +4,9 @@ import ( "context" "sync" - "github.com/ncruces/go-sqlite3/internal/util" "github.com/tetratelabs/wazero/api" + + "github.com/ncruces/go-sqlite3/internal/util" ) // CollationNeeded registers a callback to be invoked diff --git a/gormlite/error_translator.go b/gormlite/error_translator.go index b076707..1214338 100644 --- a/gormlite/error_translator.go +++ b/gormlite/error_translator.go @@ -3,8 +3,9 @@ package gormlite import ( "errors" - "github.com/ncruces/go-sqlite3" "gorm.io/gorm" + + "github.com/ncruces/go-sqlite3" ) func (_Dialector) Translate(err error) error { diff --git a/gormlite/error_translator_test.go b/gormlite/error_translator_test.go index aaa5073..5469375 100644 --- a/gormlite/error_translator_test.go +++ b/gormlite/error_translator_test.go @@ -3,9 +3,10 @@ package gormlite import ( "testing" - "github.com/ncruces/go-sqlite3/vfs/memdb" "gorm.io/gorm" "gorm.io/gorm/logger" + + "github.com/ncruces/go-sqlite3/vfs/memdb" ) func TestErrorTranslator(t *testing.T) { diff --git a/internal/testcfg/testcfg.go b/internal/testcfg/testcfg.go index 0e86a2b..fb5cbdc 100644 --- a/internal/testcfg/testcfg.go +++ b/internal/testcfg/testcfg.go @@ -4,8 +4,9 @@ import ( "os" "path/filepath" - "github.com/ncruces/go-sqlite3" "github.com/tetratelabs/wazero" + + "github.com/ncruces/go-sqlite3" ) // notest diff --git a/internal/util/module.go b/internal/util/module.go index 4aab0f9..4089dca 100644 --- a/internal/util/module.go +++ b/internal/util/module.go @@ -3,8 +3,9 @@ package util import ( "context" - "github.com/ncruces/go-sqlite3/internal/alloc" "github.com/tetratelabs/wazero/experimental" + + "github.com/ncruces/go-sqlite3/internal/alloc" ) type moduleKey struct{} diff --git a/sqlite.go b/sqlite.go index 7d7b66c..2afe997 100644 --- a/sqlite.go +++ b/sqlite.go @@ -9,11 +9,12 @@ import ( "sync" "unsafe" - "github.com/ncruces/go-sqlite3/internal/util" - "github.com/ncruces/go-sqlite3/vfs" "github.com/tetratelabs/wazero" "github.com/tetratelabs/wazero/api" "github.com/tetratelabs/wazero/experimental" + + "github.com/ncruces/go-sqlite3/internal/util" + "github.com/ncruces/go-sqlite3/vfs" ) // Configure SQLite Wasm. diff --git a/tests/json_test.go b/tests/json_test.go index d631905..0fa4ce0 100644 --- a/tests/json_test.go +++ b/tests/json_test.go @@ -7,12 +7,13 @@ import ( "testing" "time" + "github.com/ncruces/julianday" + "github.com/ncruces/go-sqlite3" "github.com/ncruces/go-sqlite3/driver" _ "github.com/ncruces/go-sqlite3/embed" _ "github.com/ncruces/go-sqlite3/internal/testcfg" "github.com/ncruces/go-sqlite3/vfs/memdb" - "github.com/ncruces/julianday" ) func TestJSON(t *testing.T) { diff --git a/time.go b/time.go index d9c516c..8a0b61b 100644 --- a/time.go +++ b/time.go @@ -6,8 +6,9 @@ import ( "strings" "time" - "github.com/ncruces/go-sqlite3/internal/util" "github.com/ncruces/julianday" + + "github.com/ncruces/go-sqlite3/internal/util" ) // TimeFormat specifies how to encode/decode time values. diff --git a/txn.go b/txn.go index bd24724..18d421e 100644 --- a/txn.go +++ b/txn.go @@ -8,8 +8,9 @@ import ( "strconv" "strings" - "github.com/ncruces/go-sqlite3/internal/util" "github.com/tetratelabs/wazero/api" + + "github.com/ncruces/go-sqlite3/internal/util" ) // Txn is an in-progress database transaction. diff --git a/util/vtabutil/parse.go b/util/vtabutil/parse.go index a31c049..10a4a32 100644 --- a/util/vtabutil/parse.go +++ b/util/vtabutil/parse.go @@ -6,9 +6,10 @@ import ( _ "embed" - "github.com/ncruces/go-sqlite3/internal/util" "github.com/tetratelabs/wazero" "github.com/tetratelabs/wazero/api" + + "github.com/ncruces/go-sqlite3/internal/util" ) const ( diff --git a/vfs/adiantum/api.go b/vfs/adiantum/api.go index bbfc89b..09b180a 100644 --- a/vfs/adiantum/api.go +++ b/vfs/adiantum/api.go @@ -34,8 +34,9 @@ package adiantum import ( - "github.com/ncruces/go-sqlite3/vfs" "lukechampine.com/adiantum/hbsh" + + "github.com/ncruces/go-sqlite3/vfs" ) func init() { diff --git a/vfs/adiantum/example_test.go b/vfs/adiantum/example_test.go index 27c99c5..590e9af 100644 --- a/vfs/adiantum/example_test.go +++ b/vfs/adiantum/example_test.go @@ -7,12 +7,13 @@ import ( "log" "os" - "github.com/ncruces/go-sqlite3" - "github.com/ncruces/go-sqlite3/vfs" - "github.com/ncruces/go-sqlite3/vfs/adiantum" "golang.org/x/crypto/argon2" "lukechampine.com/adiantum/hbsh" "lukechampine.com/adiantum/hpolyc" + + "github.com/ncruces/go-sqlite3" + "github.com/ncruces/go-sqlite3/vfs" + "github.com/ncruces/go-sqlite3/vfs/adiantum" ) func ExampleRegister_hpolyc() { diff --git a/vfs/adiantum/hbsh.go b/vfs/adiantum/hbsh.go index 096c178..1d20fea 100644 --- a/vfs/adiantum/hbsh.go +++ b/vfs/adiantum/hbsh.go @@ -5,10 +5,11 @@ import ( "encoding/hex" "io" + "lukechampine.com/adiantum/hbsh" + "github.com/ncruces/go-sqlite3" "github.com/ncruces/go-sqlite3/internal/util" "github.com/ncruces/go-sqlite3/vfs" - "lukechampine.com/adiantum/hbsh" ) type hbshVFS struct { diff --git a/vfs/filename.go b/vfs/filename.go index 51d0b8d..d9a29cd 100644 --- a/vfs/filename.go +++ b/vfs/filename.go @@ -4,8 +4,9 @@ import ( "context" "net/url" - "github.com/ncruces/go-sqlite3/internal/util" "github.com/tetratelabs/wazero/api" + + "github.com/ncruces/go-sqlite3/internal/util" ) // Filename is used by SQLite to pass filenames diff --git a/vfs/lock_test.go b/vfs/lock_test.go index 7f338b1..7c19bfd 100644 --- a/vfs/lock_test.go +++ b/vfs/lock_test.go @@ -6,8 +6,9 @@ import ( "path/filepath" "testing" - "github.com/ncruces/go-sqlite3/internal/util" "github.com/tetratelabs/wazero/experimental/wazerotest" + + "github.com/ncruces/go-sqlite3/internal/util" ) func Test_vfsLock(t *testing.T) { diff --git a/vfs/readervfs/example_test.go b/vfs/readervfs/example_test.go index 28b25cb..712a556 100644 --- a/vfs/readervfs/example_test.go +++ b/vfs/readervfs/example_test.go @@ -8,11 +8,12 @@ import ( _ "embed" + "github.com/psanford/httpreadat" + _ "github.com/ncruces/go-sqlite3/driver" _ "github.com/ncruces/go-sqlite3/embed" "github.com/ncruces/go-sqlite3/util/ioutil" "github.com/ncruces/go-sqlite3/vfs/readervfs" - "github.com/psanford/httpreadat" ) func Example_http() { diff --git a/vfs/shm.go b/vfs/shm.go index c8163cd..e2f04d6 100644 --- a/vfs/shm.go +++ b/vfs/shm.go @@ -9,9 +9,10 @@ import ( "sync" "time" - "github.com/ncruces/go-sqlite3/internal/util" "github.com/tetratelabs/wazero/api" "golang.org/x/sys/unix" + + "github.com/ncruces/go-sqlite3/internal/util" ) // SupportsSharedMemory is false on platforms that do not support shared memory. diff --git a/vfs/shm_bsd.go b/vfs/shm_bsd.go index dde90db..7657b0d 100644 --- a/vfs/shm_bsd.go +++ b/vfs/shm_bsd.go @@ -8,9 +8,10 @@ import ( "os" "sync" - "github.com/ncruces/go-sqlite3/internal/util" "github.com/tetratelabs/wazero/api" "golang.org/x/sys/unix" + + "github.com/ncruces/go-sqlite3/internal/util" ) // SupportsSharedMemory is false on platforms that do not support shared memory. diff --git a/vfs/tests/mptest/mptest_test.go b/vfs/tests/mptest/mptest_test.go index 0318877..ab44b3b 100644 --- a/vfs/tests/mptest/mptest_test.go +++ b/vfs/tests/mptest/mptest_test.go @@ -17,15 +17,16 @@ import ( "sync/atomic" "testing" + "github.com/tetratelabs/wazero" + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/experimental" + "github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1" + "github.com/ncruces/go-sqlite3/internal/util" "github.com/ncruces/go-sqlite3/vfs" _ "github.com/ncruces/go-sqlite3/vfs/adiantum" "github.com/ncruces/go-sqlite3/vfs/memdb" _ "github.com/ncruces/go-sqlite3/vfs/xts" - "github.com/tetratelabs/wazero" - "github.com/tetratelabs/wazero/api" - "github.com/tetratelabs/wazero/experimental" - "github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1" ) //go:embed testdata/mptest.wasm.bz2 diff --git a/vfs/vfs.go b/vfs/vfs.go index 8235490..4a3b547 100644 --- a/vfs/vfs.go +++ b/vfs/vfs.go @@ -7,10 +7,11 @@ import ( "reflect" "time" - "github.com/ncruces/go-sqlite3/internal/util" - "github.com/ncruces/julianday" "github.com/tetratelabs/wazero" "github.com/tetratelabs/wazero/api" + + "github.com/ncruces/go-sqlite3/internal/util" + "github.com/ncruces/julianday" ) // ExportHostFunctions is an internal API users need not call directly. diff --git a/vfs/vfs_test.go b/vfs/vfs_test.go index 701dc6c..c10a19e 100644 --- a/vfs/vfs_test.go +++ b/vfs/vfs_test.go @@ -13,9 +13,10 @@ import ( "testing" "time" + "github.com/tetratelabs/wazero/experimental/wazerotest" + "github.com/ncruces/go-sqlite3/internal/util" "github.com/ncruces/julianday" - "github.com/tetratelabs/wazero/experimental/wazerotest" ) func Test_vfsLocaltime(t *testing.T) { diff --git a/vfs/xts/api.go b/vfs/xts/api.go index ad30fb2..4bf197d 100644 --- a/vfs/xts/api.go +++ b/vfs/xts/api.go @@ -34,8 +34,9 @@ package xts import ( - "github.com/ncruces/go-sqlite3/vfs" "golang.org/x/crypto/xts" + + "github.com/ncruces/go-sqlite3/vfs" ) func init() { diff --git a/vtab.go b/vtab.go index 2bb294b..9834862 100644 --- a/vtab.go +++ b/vtab.go @@ -4,8 +4,9 @@ import ( "context" "reflect" - "github.com/ncruces/go-sqlite3/internal/util" "github.com/tetratelabs/wazero/api" + + "github.com/ncruces/go-sqlite3/internal/util" ) // CreateModule registers a new virtual table module name.