From 34c9f0c81342108855a7ed156d45cd79afe40022 Mon Sep 17 00:00:00 2001 From: boojack Date: Mon, 30 Mar 2026 23:34:43 +0800 Subject: [PATCH] fix(test): satisfy golangci-lint in migration coverage --- store/test/containers.go | 1 - store/test/migrator_upgrade_test.go | 9 +++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/store/test/containers.go b/store/test/containers.go index 07860927d..485f59709 100644 --- a/store/test/containers.go +++ b/store/test/containers.go @@ -23,7 +23,6 @@ import ( "github.com/testcontainers/testcontainers-go/wait" // Database drivers for connection verification. - _ "github.com/go-sql-driver/mysql" _ "github.com/lib/pq" ) diff --git a/store/test/migrator_upgrade_test.go b/store/test/migrator_upgrade_test.go index 0d9c285f3..b0b56eac4 100644 --- a/store/test/migrator_upgrade_test.go +++ b/store/test/migrator_upgrade_test.go @@ -9,6 +9,7 @@ import ( "testing" "time" + "github.com/pkg/errors" "github.com/stretchr/testify/require" storepb "github.com/usememos/memos/proto/gen/store" @@ -189,10 +190,10 @@ func legacyInsertUserSQL(driver string, id int, username string) string { switch driver { case "mysql": table = "`user`" - case "postgres": - table = `"user"` - case "sqlite": + case "postgres", "sqlite": table = `"user"` + default: + // Keep the unquoted fallback for unknown test drivers. } return fmt.Sprintf( @@ -262,6 +263,6 @@ func tableExists(ctx context.Context, db *sql.DB, driver, table string) (bool, e err := db.QueryRowContext(ctx, "SELECT to_regclass($1)", "public."+table).Scan(®class) return regclass.Valid && strings.EqualFold(regclass.String, table), err default: - return false, fmt.Errorf("unsupported driver: %s", driver) + return false, errors.Errorf("unsupported driver: %s", driver) } }