mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-21 23:22:34 +01:00
fix(channelserver): resolve all golangci-lint issues and add handler tests
Fix errcheck violations across 11 repo files by wrapping deferred rows.Close() and tx.Rollback() calls to discard the error return. Fix unchecked Scan/Exec calls in guild store tests. Fix staticcheck SA9003 empty branch in test helpers. Add 6 mock-based unit tests for GetCharacterSaveData covering nil savedata, sql.ErrNoRows, DB errors, compressed round-trip, new-character skip, and config mode/pointer propagation.
This commit is contained in:
@@ -173,9 +173,7 @@ func applyUpdateSchema(t *testing.T, db *sqlx.DB, projectRoot string) {
|
||||
if stmt == "" {
|
||||
continue
|
||||
}
|
||||
if _, err := db.Exec(stmt); err != nil {
|
||||
// Silently ignore — these are expected for role mismatches, already-applied changes, etc.
|
||||
}
|
||||
_, _ = db.Exec(stmt) // Errors expected for role mismatches, already-applied changes, etc.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,7 +258,7 @@ func truncateAllTables(t *testing.T, db *sqlx.DB) {
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to list tables for truncation: %v", err)
|
||||
}
|
||||
defer rows.Close()
|
||||
defer func() { _ = rows.Close() }()
|
||||
|
||||
var tables []string
|
||||
for rows.Next() {
|
||||
|
||||
Reference in New Issue
Block a user