refactor(store): swap mattn/go-sqlite3 for modernc.org/sqlite
CI / test (pull_request) Successful in 2m0s
CI / lint (pull_request) Successful in 1m22s
CI / vulncheck (pull_request) Successful in 56s

Pure-Go SQLite driver — no CGO, no C compiler. Enables:
- static binaries (verified: `file` shows statically linked)
- cross-compile to linux/arm64, darwin/amd64+arm64, windows/amd64+arm64
- goreleaser now builds 6 OS/arch targets + windows .zip
- Dockerfile drops gcc/musl-dev, sets CGO_ENABLED=0
- release-binaries drops gcc/musl-dev

Driver name changes sqlite3 → sqlite, DSN pragmas use
_pragma=name(value) format. All tests pass CGO=0 and CGO=1 -race.

Homebrew cask block removed (was skip_upload:true dead config).
This commit was merged in pull request #104.
This commit is contained in:
2026-06-11 13:10:05 -04:00
parent d1ab842283
commit 61c28fac62
6 changed files with 55 additions and 28 deletions
+4 -4
View File
@@ -5,7 +5,7 @@ import (
"fmt"
"log"
_ "github.com/mattn/go-sqlite3"
_ "modernc.org/sqlite"
)
type SQLiteDialect struct{}
@@ -19,16 +19,16 @@ func NewSQLiteStore(path string) (*SQLStore, error) {
// these pragmas are no-ops or harmful for the in-memory test DB.)
dsn := path
if path != ":memory:" {
dsn = fmt.Sprintf("file:%s?_journal_mode=WAL&_busy_timeout=5000&_synchronous=NORMAL", path)
dsn = fmt.Sprintf("file:%s?_pragma=journal_mode(wal)&_pragma=busy_timeout(5000)&_pragma=synchronous(normal)", path)
}
s, err := NewSQLStore("sqlite3", dsn, &SQLiteDialect{})
s, err := NewSQLStore("sqlite", dsn, &SQLiteDialect{})
if err != nil {
return nil, err
}
return s, nil
}
func (d *SQLiteDialect) DriverName() string { return "sqlite3" }
func (d *SQLiteDialect) DriverName() string { return "sqlite" }
func (d *SQLiteDialect) BoolFalse() string { return "0" }
func (d *SQLiteDialect) CreateTablesSQL() []string {