style: 合入后修 gofmt/govet 与 RegistrationView 类型检查

This commit is contained in:
Nixevol
2026-09-30 16:34:33 +08:00
parent 8f2ebc7d21
commit 0c9b459fb1
18 changed files with 74 additions and 79 deletions
+7 -7
View File
@@ -198,14 +198,14 @@ func TestC03WALShrinksAfterPurge(t *testing.T) {
ctx := context.Background()
nowMs := int64(1_700_000_000_000)
err = db.Queue.Do(ctx, func(tx *sql.Tx) error {
if _, err := tx.Exec(`INSERT INTO endpoints(id,name,login_hash,enabled,created_at) VALUES('alice','a','x',1,?)`, nowMs); err != nil {
return err
if _, insErr := tx.Exec(`INSERT INTO endpoints(id,name,login_hash,enabled,created_at) VALUES('alice','a','x',1,?)`, nowMs); insErr != nil {
return insErr
}
for i := 0; i < 200; i++ {
if _, err := tx.Exec(`INSERT INTO messages(id, sender_id, dest_kind, dest_id, meta, content_type, body_enc, send_at, keep, ttl_seconds, receipt, state, reason, created_at)
if _, insErr := tx.Exec(`INSERT INTO messages(id, sender_id, dest_kind, dest_id, meta, content_type, body_enc, send_at, keep, ttl_seconds, receipt, state, reason, created_at)
VALUES(?,?, 'endpoint','bob','{}','text/plain','utf8',?,0,0,0,'completed','',?)`,
"m"+itoa(i), "alice", nowMs-10*24*3600*1000, nowMs-10*24*3600*1000); err != nil {
return err
"m"+itoa(i), "alice", nowMs-10*24*3600*1000, nowMs-10*24*3600*1000); insErr != nil {
return insErr
}
}
return nil
@@ -217,8 +217,8 @@ VALUES(?,?, 'endpoint','bob','{}','text/plain','utf8',?,0,0,0,'completed','',?)`
before, _ := os.Stat(walPath)
app := New(db, Limits{RecordRetentionDays: 1, ReceiptRetentionDays: 1, IdempotencyHours: 1}, nil)
app.nowFn = func() time.Time { return time.UnixMilli(nowMs) }
if err := app.PurgeOnce(ctx, nowMs); err != nil {
t.Fatal(err)
if purgeErr := app.PurgeOnce(ctx, nowMs); purgeErr != nil {
t.Fatal(purgeErr)
}
after, err := os.Stat(walPath)
if err == nil && before != nil && after.Size() > before.Size() {