Fix SQLite driver for CGO_ENABLED=0 builds
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:
1 parent
9a3d35bde4
commit
6ec39da5da
3 files changed
+62
-5
No files matched your search
@@ -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)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user