Merge pull request #202 from bnema/feat/purego-sqlite
feat: replace ncruces/go-sqlite3 with purego-sqlite
6 files · +10 -28
M cmd/dumber/main.go +0 -3
| @@ -342,9 +342,6 @@ func handleParallelInitError(ctx context.Context, err error) { | |||
| 342 | 342 | ||
| 343 | 343 | func logDeferredInitResults(ctx context.Context, result bootstrap.DeferredInitResult) { | |
| 344 | 344 | log := logging.FromContext(ctx) | |
| 345 | - | if result.SQLiteErr != nil { | |
| 346 | - | log.Warn().Err(result.SQLiteErr).Msg("deferred sqlite wasm init failed") | |
| 347 | - | } | |
| 348 | 345 | if result.RuntimeErr != nil { | |
| 349 | 346 | if runtimeErr, ok := result.RuntimeErr.(*bootstrap.RuntimeRequirementsError); ok { | |
| 350 | 347 | runtimeErr.LogDetails(ctx) | |
| @@ -342,9 +342,6 @@ func handleParallelInitError(ctx context.Context, err error) { | |||||
| 342 | 342 | ||||
| 343 | func logDeferredInitResults(ctx context.Context, result bootstrap.DeferredInitResult) { | 343 | func logDeferredInitResults(ctx context.Context, result bootstrap.DeferredInitResult) { | ||
| 344 | log := logging.FromContext(ctx) | 344 | log := logging.FromContext(ctx) | ||
| 345 | - | if result.SQLiteErr != nil { | |||
| 346 | - | log.Warn().Err(result.SQLiteErr).Msg("deferred sqlite wasm init failed") | |||
| 347 | - | } | |||
| 348 | if result.RuntimeErr != nil { | 345 | if result.RuntimeErr != nil { | ||
| 349 | if runtimeErr, ok := result.RuntimeErr.(*bootstrap.RuntimeRequirementsError); ok { | 346 | if runtimeErr, ok := result.RuntimeErr.(*bootstrap.RuntimeRequirementsError); ok { | ||
| 350 | runtimeErr.LogDetails(ctx) | 347 | runtimeErr.LogDetails(ctx) | ||
M go.mod +1 -3
| @@ -3,6 +3,7 @@ module github.com/bnema/dumber | |||
| 3 | 3 | go 1.26.1 | |
| 4 | 4 | ||
| 5 | 5 | require ( | |
| 6 | + | github.com/bnema/purego-sqlite v0.1.1 | |
| 6 | 7 | github.com/bnema/puregotk v0.2.0 | |
| 7 | 8 | github.com/bnema/puregotk-webkit v0.0.15 | |
| 8 | 9 | github.com/charmbracelet/bubbles v1.0.0 | |
| @@ -11,7 +12,6 @@ require ( | |||
| 11 | 12 | github.com/ebitengine/purego v0.10.0 | |
| 12 | 13 | github.com/fsnotify/fsnotify v1.9.0 | |
| 13 | 14 | github.com/godbus/dbus/v5 v5.2.2 | |
| 14 | - | github.com/ncruces/go-sqlite3 v0.32.0 | |
| 15 | 15 | github.com/pelletier/go-toml/v2 v2.2.4 | |
| 16 | 16 | github.com/pressly/goose/v3 v3.27.0 | |
| 17 | 17 | github.com/rs/zerolog v1.34.0 | |
| @@ -49,7 +49,6 @@ require ( | |||
| 49 | 49 | github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect | |
| 50 | 50 | github.com/muesli/cancelreader v0.2.2 // indirect | |
| 51 | 51 | github.com/muesli/termenv v0.16.0 // indirect | |
| 52 | - | github.com/ncruces/julianday v1.0.0 // indirect | |
| 53 | 52 | github.com/pmezard/go-difflib v1.0.0 // indirect | |
| 54 | 53 | github.com/rivo/uniseg v0.4.7 // indirect | |
| 55 | 54 | github.com/russross/blackfriday/v2 v2.1.0 // indirect | |
| @@ -61,7 +60,6 @@ require ( | |||
| 61 | 60 | github.com/spf13/pflag v1.0.10 // indirect | |
| 62 | 61 | github.com/stretchr/objx v0.5.3 // indirect | |
| 63 | 62 | github.com/subosito/gotenv v1.6.0 // indirect | |
| 64 | - | github.com/tetratelabs/wazero v1.11.0 // indirect | |
| 65 | 63 | github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect | |
| 66 | 64 | go.uber.org/multierr v1.11.0 // indirect | |
| 67 | 65 | go.yaml.in/yaml/v3 v3.0.4 // indirect | |
| @@ -3,6 +3,7 @@ module github.com/bnema/dumber | |||||
| 3 | go 1.26.1 | 3 | go 1.26.1 | ||
| 4 | 4 | ||||
| 5 | require ( | 5 | require ( | ||
| 6 | + | github.com/bnema/purego-sqlite v0.1.1 | |||
| 6 | github.com/bnema/puregotk v0.2.0 | 7 | github.com/bnema/puregotk v0.2.0 | ||
| 7 | github.com/bnema/puregotk-webkit v0.0.15 | 8 | github.com/bnema/puregotk-webkit v0.0.15 | ||
| 8 | github.com/charmbracelet/bubbles v1.0.0 | 9 | github.com/charmbracelet/bubbles v1.0.0 | ||
| @@ -11,7 +12,6 @@ require ( | |||||
| 11 | github.com/ebitengine/purego v0.10.0 | 12 | github.com/ebitengine/purego v0.10.0 | ||
| 12 | github.com/fsnotify/fsnotify v1.9.0 | 13 | github.com/fsnotify/fsnotify v1.9.0 | ||
| 13 | github.com/godbus/dbus/v5 v5.2.2 | 14 | github.com/godbus/dbus/v5 v5.2.2 | ||
| 14 | - | github.com/ncruces/go-sqlite3 v0.32.0 | |||
| 15 | github.com/pelletier/go-toml/v2 v2.2.4 | 15 | github.com/pelletier/go-toml/v2 v2.2.4 | ||
| 16 | github.com/pressly/goose/v3 v3.27.0 | 16 | github.com/pressly/goose/v3 v3.27.0 | ||
| 17 | github.com/rs/zerolog v1.34.0 | 17 | github.com/rs/zerolog v1.34.0 | ||
| @@ -49,7 +49,6 @@ require ( | |||||
| 49 | github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect | 49 | github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect | ||
| 50 | github.com/muesli/cancelreader v0.2.2 // indirect | 50 | github.com/muesli/cancelreader v0.2.2 // indirect | ||
| 51 | github.com/muesli/termenv v0.16.0 // indirect | 51 | github.com/muesli/termenv v0.16.0 // indirect | ||
| 52 | - | github.com/ncruces/julianday v1.0.0 // indirect | |||
| 53 | github.com/pmezard/go-difflib v1.0.0 // indirect | 52 | github.com/pmezard/go-difflib v1.0.0 // indirect | ||
| 54 | github.com/rivo/uniseg v0.4.7 // indirect | 53 | github.com/rivo/uniseg v0.4.7 // indirect | ||
| 55 | github.com/russross/blackfriday/v2 v2.1.0 // indirect | 54 | github.com/russross/blackfriday/v2 v2.1.0 // indirect | ||
| @@ -61,7 +60,6 @@ require ( | |||||
| 61 | github.com/spf13/pflag v1.0.10 // indirect | 60 | github.com/spf13/pflag v1.0.10 // indirect | ||
| 62 | github.com/stretchr/objx v0.5.3 // indirect | 61 | github.com/stretchr/objx v0.5.3 // indirect | ||
| 63 | github.com/subosito/gotenv v1.6.0 // indirect | 62 | github.com/subosito/gotenv v1.6.0 // indirect | ||
| 64 | - | github.com/tetratelabs/wazero v1.11.0 // indirect | |||
| 65 | github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect | 63 | github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect | ||
| 66 | go.uber.org/multierr v1.11.0 // indirect | 64 | go.uber.org/multierr v1.11.0 // indirect | ||
| 67 | go.yaml.in/yaml/v3 v3.0.4 // indirect | 65 | go.yaml.in/yaml/v3 v3.0.4 // indirect | ||
M go.sum +2 -6 generated file: collapsed
M internal/bootstrap/gui.go +1 -10
| @@ -20,7 +20,6 @@ import ( | |||
| 20 | 20 | "github.com/bnema/dumber/internal/infrastructure/persistence/sqlite" | |
| 21 | 21 | "github.com/bnema/dumber/internal/logging" | |
| 22 | 22 | "github.com/bnema/dumber/internal/ui/theme" | |
| 23 | - | sqlite3 "github.com/ncruces/go-sqlite3" | |
| 24 | 23 | ) | |
| 25 | 24 | ||
| 26 | 25 | // DatabaseResult holds database connection and cleanup function. | |
| @@ -43,7 +42,6 @@ type ParallelInitResult struct { | |||
| 43 | 42 | type DeferredInitResult struct { | |
| 44 | 43 | RuntimeErr error | |
| 45 | 44 | MediaErr error | |
| 46 | - | SQLiteErr error | |
| 47 | 45 | Duration time.Duration | |
| 48 | 46 | } | |
| 49 | 47 | ||
| @@ -155,17 +153,11 @@ func RunDeferredInit(input DeferredInitInput) DeferredInitResult { | |||
| 155 | 153 | var ( | |
| 156 | 154 | runtimeErr error | |
| 157 | 155 | mediaErr error | |
| 158 | - | sqliteErr error | |
| 159 | 156 | wg sync.WaitGroup | |
| 160 | 157 | ) | |
| 161 | 158 | ||
| 162 | 159 | start := time.Now() | |
| 163 | - | wg.Add(3) | |
| 164 | - | ||
| 165 | - | go func() { | |
| 166 | - | defer wg.Done() | |
| 167 | - | sqliteErr = sqlite3.Initialize() | |
| 168 | - | }() | |
| 160 | + | wg.Add(2) | |
| 169 | 161 | ||
| 170 | 162 | go func() { | |
| 171 | 163 | defer wg.Done() | |
| @@ -182,7 +174,6 @@ func RunDeferredInit(input DeferredInitInput) DeferredInitResult { | |||
| 182 | 174 | return DeferredInitResult{ | |
| 183 | 175 | RuntimeErr: runtimeErr, | |
| 184 | 176 | MediaErr: mediaErr, | |
| 185 | - | SQLiteErr: sqliteErr, | |
| 186 | 177 | Duration: time.Since(start), | |
| 187 | 178 | } | |
| 188 | 179 | } | |
| @@ -20,7 +20,6 @@ import ( | |||||
| 20 | "github.com/bnema/dumber/internal/infrastructure/persistence/sqlite" | 20 | "github.com/bnema/dumber/internal/infrastructure/persistence/sqlite" | ||
| 21 | "github.com/bnema/dumber/internal/logging" | 21 | "github.com/bnema/dumber/internal/logging" | ||
| 22 | "github.com/bnema/dumber/internal/ui/theme" | 22 | "github.com/bnema/dumber/internal/ui/theme" | ||
| 23 | - | sqlite3 "github.com/ncruces/go-sqlite3" | |||
| 24 | ) | 23 | ) | ||
| 25 | 24 | ||||
| 26 | // DatabaseResult holds database connection and cleanup function. | 25 | // DatabaseResult holds database connection and cleanup function. | ||
| @@ -43,7 +42,6 @@ type ParallelInitResult struct { | |||||
| 43 | type DeferredInitResult struct { | 42 | type DeferredInitResult struct { | ||
| 44 | RuntimeErr error | 43 | RuntimeErr error | ||
| 45 | MediaErr error | 44 | MediaErr error | ||
| 46 | - | SQLiteErr error | |||
| 47 | Duration time.Duration | 45 | Duration time.Duration | ||
| 48 | } | 46 | } | ||
| 49 | 47 | ||||
| @@ -155,17 +153,11 @@ func RunDeferredInit(input DeferredInitInput) DeferredInitResult { | |||||
| 155 | var ( | 153 | var ( | ||
| 156 | runtimeErr error | 154 | runtimeErr error | ||
| 157 | mediaErr error | 155 | mediaErr error | ||
| 158 | - | sqliteErr error | |||
| 159 | wg sync.WaitGroup | 156 | wg sync.WaitGroup | ||
| 160 | ) | 157 | ) | ||
| 161 | 158 | ||||
| 162 | start := time.Now() | 159 | start := time.Now() | ||
| 163 | - | wg.Add(3) | 160 | + | wg.Add(2) |
| 164 | - | ||||
| 165 | - | go func() { | |||
| 166 | - | defer wg.Done() | |||
| 167 | - | sqliteErr = sqlite3.Initialize() | |||
| 168 | - | }() | |||
| 169 | 161 | ||||
| 170 | go func() { | 162 | go func() { | ||
| 171 | defer wg.Done() | 163 | defer wg.Done() | ||
| @@ -182,7 +174,6 @@ func RunDeferredInit(input DeferredInitInput) DeferredInitResult { | |||||
| 182 | return DeferredInitResult{ | 174 | return DeferredInitResult{ | ||
| 183 | RuntimeErr: runtimeErr, | 175 | RuntimeErr: runtimeErr, | ||
| 184 | MediaErr: mediaErr, | 176 | MediaErr: mediaErr, | ||
| 185 | - | SQLiteErr: sqliteErr, | |||
| 186 | Duration: time.Since(start), | 177 | Duration: time.Since(start), | ||
| 187 | } | 178 | } | ||
| 188 | } | 179 | } | ||
M internal/infrastructure/persistence/sqlite/connection.go +1 -2
| @@ -8,8 +8,7 @@ import ( | |||
| 8 | 8 | "path/filepath" | |
| 9 | 9 | ||
| 10 | 10 | "github.com/bnema/dumber/internal/logging" | |
| 11 | - | _ "github.com/ncruces/go-sqlite3/driver" // SQLite driver (pure Go) | |
| 12 | - | _ "github.com/ncruces/go-sqlite3/embed" // Embed SQLite WASM binary | |
| 11 | + | _ "github.com/bnema/purego-sqlite/driver" // SQLite driver (purego, no WASM/CGo) | |
| 13 | 12 | ) | |
| 14 | 13 | ||
| 15 | 14 | // NewConnection creates a new SQLite database connection with optimized settings. | |
| @@ -8,8 +8,7 @@ import ( | |||||
| 8 | "path/filepath" | 8 | "path/filepath" | ||
| 9 | 9 | ||||
| 10 | "github.com/bnema/dumber/internal/logging" | 10 | "github.com/bnema/dumber/internal/logging" | ||
| 11 | - | _ "github.com/ncruces/go-sqlite3/driver" // SQLite driver (pure Go) | 11 | + | _ "github.com/bnema/purego-sqlite/driver" // SQLite driver (purego, no WASM/CGo) |
| 12 | - | _ "github.com/ncruces/go-sqlite3/embed" // Embed SQLite WASM binary | |||
| 13 | ) | 12 | ) | ||
| 14 | 13 | ||||
| 15 | // NewConnection creates a new SQLite database connection with optimized settings. | 14 | // NewConnection creates a new SQLite database connection with optimized settings. | ||
M internal/ui/component/omnibox.go +5 -4
| @@ -9,6 +9,11 @@ import ( | |||
| 9 | 9 | "time" | |
| 10 | 10 | "unicode/utf8" | |
| 11 | 11 | ||
| 12 | + | "github.com/bnema/puregotk/v4/gdk" | |
| 13 | + | "github.com/bnema/puregotk/v4/glib" | |
| 14 | + | "github.com/bnema/puregotk/v4/graphene" | |
| 15 | + | "github.com/bnema/puregotk/v4/gtk" | |
| 16 | + | ||
| 12 | 17 | "github.com/bnema/dumber/internal/application/usecase" | |
| 13 | 18 | "github.com/bnema/dumber/internal/domain/autocomplete" | |
| 14 | 19 | "github.com/bnema/dumber/internal/domain/entity" | |
| @@ -18,10 +23,6 @@ import ( | |||
| 18 | 23 | "github.com/bnema/dumber/internal/ui/input" | |
| 19 | 24 | "github.com/bnema/dumber/internal/ui/layout" | |
| 20 | 25 | "github.com/bnema/dumber/internal/ui/mainloop" | |
| 21 | - | "github.com/bnema/puregotk/v4/gdk" | |
| 22 | - | "github.com/bnema/puregotk/v4/glib" | |
| 23 | - | "github.com/bnema/puregotk/v4/graphene" | |
| 24 | - | "github.com/bnema/puregotk/v4/gtk" | |
| 25 | 26 | ) | |
| 26 | 27 | ||
| 27 | 28 | const ( | |
| @@ -9,6 +9,11 @@ import ( | |||||
| 9 | "time" | 9 | "time" | ||
| 10 | "unicode/utf8" | 10 | "unicode/utf8" | ||
| 11 | 11 | ||||
| 12 | + | "github.com/bnema/puregotk/v4/gdk" | |||
| 13 | + | "github.com/bnema/puregotk/v4/glib" | |||
| 14 | + | "github.com/bnema/puregotk/v4/graphene" | |||
| 15 | + | "github.com/bnema/puregotk/v4/gtk" | |||
| 16 | + | ||||
| 12 | "github.com/bnema/dumber/internal/application/usecase" | 17 | "github.com/bnema/dumber/internal/application/usecase" | ||
| 13 | "github.com/bnema/dumber/internal/domain/autocomplete" | 18 | "github.com/bnema/dumber/internal/domain/autocomplete" | ||
| 14 | "github.com/bnema/dumber/internal/domain/entity" | 19 | "github.com/bnema/dumber/internal/domain/entity" | ||
| @@ -18,10 +23,6 @@ import ( | |||||
| 18 | "github.com/bnema/dumber/internal/ui/input" | 23 | "github.com/bnema/dumber/internal/ui/input" | ||
| 19 | "github.com/bnema/dumber/internal/ui/layout" | 24 | "github.com/bnema/dumber/internal/ui/layout" | ||
| 20 | "github.com/bnema/dumber/internal/ui/mainloop" | 25 | "github.com/bnema/dumber/internal/ui/mainloop" | ||
| 21 | - | "github.com/bnema/puregotk/v4/gdk" | |||
| 22 | - | "github.com/bnema/puregotk/v4/glib" | |||
| 23 | - | "github.com/bnema/puregotk/v4/graphene" | |||
| 24 | - | "github.com/bnema/puregotk/v4/gtk" | |||
| 25 | ) | 26 | ) | ||
| 26 | 27 | ||||
| 27 | const ( | 28 | const ( | ||