Fix SQLite driver for CGO_ENABLED=0 builds
CI/CD / test (push) Successful in 1m33s
CI/CD / build (push) Successful in 1m13s
CI/CD / docker (push) Successful in 2m30s

Replace github.com/mattn/go-sqlite3 (CGO required) with
modernc.org/sqlite (pure Go, works with CGO_ENABLED=0).
Binary built with CGO_ENABLED=0 in Dockerfile can now load
SQLite storage without cgo errors.
This commit is contained in:
Mrixs committed 2026-10-18 00:52:58 +03:00
1 parent 9a3d35bde4
commit 6ec39da5da
3 files changed
+62 -5

No files matched your search

+2 -2
View File
@@ -12,7 +12,7 @@ import (
"time"
"github.com/bogem/id3v2"
_ "github.com/mattn/go-sqlite3"
_ "modernc.org/sqlite"
"gitea.mrixs.me/Mrixs/yandex-music-api-go/yandexmusic"
)
@@ -77,7 +77,7 @@ func NewStorage(rootPath string, organize bool) (*Storage, error) {
}
dbPath := filepath.Join(rootPath, "index.db")
db, err := sql.Open("sqlite3", dbPath)
db, err := sql.Open("sqlite", dbPath)
if err != nil {
return nil, fmt.Errorf("open sqlite db: %w", err)
}