fix: use pure Go SQLite driver for arm64 compatibility

Switch from mattn/go-sqlite3 (CGO) to modernc.org/sqlite (pure Go)
for auth, audit, and notification queue storage. This enables SQLite
functionality on arm64 Docker images which are built with CGO_ENABLED=0.

Related to #1140
This commit is contained in:
rcourtman
2026-01-21 18:58:23 +00:00
parent b030584248
commit c44cb5af5b
5 changed files with 8 additions and 11 deletions

5
go.mod
View File

@@ -14,7 +14,6 @@ require (
github.com/google/uuid v1.6.0
github.com/gorilla/websocket v1.5.3
github.com/joho/godotenv v1.5.1
github.com/mattn/go-sqlite3 v1.14.32
github.com/oklog/ulid/v2 v2.1.1
github.com/opencontainers/image-spec v1.1.1
github.com/prometheus/client_golang v1.23.2
@@ -29,8 +28,6 @@ require (
golang.org/x/sync v0.18.0
golang.org/x/sys v0.38.0
golang.org/x/term v0.37.0
golang.org/x/time v0.14.0
gopkg.in/yaml.v3 v3.0.1
k8s.io/api v0.32.0
k8s.io/apimachinery v0.32.0
k8s.io/client-go v0.32.0
@@ -111,10 +108,12 @@ require (
golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b // indirect
golang.org/x/net v0.47.0 // indirect
golang.org/x/text v0.31.0 // indirect
golang.org/x/time v0.14.0 // indirect
google.golang.org/grpc v1.75.1 // indirect
google.golang.org/protobuf v1.36.10 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gotest.tools/v3 v3.5.2 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f // indirect

2
go.sum
View File

@@ -133,8 +133,6 @@ github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-sqlite3 v1.14.32 h1:JD12Ag3oLy1zQA+BNn74xRgaBbdhbNIDYvQUEuuErjs=
github.com/mattn/go-sqlite3 v1.14.32/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0=
github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo=
github.com/moby/sys/atomicwriter v0.1.0 h1:kw5D/EqkBwsBFi0ss9v1VG3wIkVhzGvLklJ+w3A14Sw=

View File

@@ -9,10 +9,10 @@ import (
"sync"
"time"
_ "github.com/mattn/go-sqlite3"
"github.com/rcourtman/pulse-go-rewrite/internal/alerts"
"github.com/rcourtman/pulse-go-rewrite/internal/utils"
"github.com/rs/zerolog/log"
_ "modernc.org/sqlite"
)
// NotificationQueueStatus represents the status of a queued notification
@@ -72,7 +72,7 @@ func NewNotificationQueue(dataDir string) (*NotificationQueue, error) {
dbPath := filepath.Join(dataDir, "notification_queue.db")
db, err := sql.Open("sqlite3", dbPath)
db, err := sql.Open("sqlite", dbPath)
if err != nil {
return nil, fmt.Errorf("failed to open notification queue database: %w", err)
}

View File

@@ -9,8 +9,8 @@ import (
"sync"
"time"
_ "github.com/mattn/go-sqlite3"
"github.com/rs/zerolog/log"
_ "modernc.org/sqlite"
)
// SQLiteLoggerConfig configures the SQLite audit logger.
@@ -46,7 +46,7 @@ func NewSQLiteLogger(cfg SQLiteLoggerConfig) (*SQLiteLogger, error) {
dbPath := filepath.Join(auditDir, "audit.db")
db, err := sql.Open("sqlite3", dbPath)
db, err := sql.Open("sqlite", dbPath)
if err != nil {
return nil, fmt.Errorf("failed to open audit database: %w", err)
}

View File

@@ -10,8 +10,8 @@ import (
"time"
"github.com/google/uuid"
_ "github.com/mattn/go-sqlite3"
"github.com/rs/zerolog/log"
_ "modernc.org/sqlite"
)
// SQLiteManagerConfig configures the SQLite RBAC manager.
@@ -43,7 +43,7 @@ func NewSQLiteManager(cfg SQLiteManagerConfig) (*SQLiteManager, error) {
dbPath := filepath.Join(rbacDir, "rbac.db")
db, err := sql.Open("sqlite3", dbPath)
db, err := sql.Open("sqlite", dbPath)
if err != nil {
return nil, fmt.Errorf("failed to open rbac database: %w", err)
}