Chore: Make cgo optional (for sqlite) (#108756)

* make cgo optional for sqlite

* update go.mod; check error code differently

* reduce api surface even more

* move test errors into sqlite package

* add a comment
This commit is contained in:
Serge Zaitsev
2025-07-31 09:25:19 +00:00
committed by GitHub
parent f39b878b0a
commit 6b1143565a
15 changed files with 160 additions and 41 deletions
+2 -2
View File
@@ -10,9 +10,9 @@ import (
"github.com/gchaincl/sqlhooks"
"github.com/go-sql-driver/mysql"
"github.com/grafana/grafana/pkg/util/sqlite"
"github.com/grafana/grafana/pkg/util/xorm/core"
"github.com/lib/pq"
"github.com/mattn/go-sqlite3"
"github.com/prometheus/client_golang/prometheus"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace"
@@ -42,7 +42,7 @@ func init() {
// database queries. It also registers the metrics.
func WrapDatabaseDriverWithHooks(dbType string, tracer tracing.Tracer) string {
drivers := map[string]driver.Driver{
migrator.SQLite: &sqlite3.SQLiteDriver{},
migrator.SQLite: &sqlite.Driver{},
migrator.MySQL: &mysql.MySQLDriver{},
migrator.Postgres: &pq.Driver{},
}