lint: fix errcheck for txn calls, query results, and unchecked errors

- Fix Rollback/Commit in compliance.go, csv/csv.go, csv/pool.go
- Capture and check errors from .One() insert queries in send.go, text.go
- Check errors from markFunc, PopulateURL, and hydrate functions
- Use lint.LogOnErrCtx for best-effort notification sends
This commit is contained in:
Eli Ribble 2026-05-09 02:35:55 +00:00
parent 0ec810591e
commit 679d12b48f
No known key found for this signature in database
10 changed files with 47 additions and 16 deletions

View file

@ -43,9 +43,12 @@ func setPhoneStatus(ctx context.Context, txn bob.Executor, src types.E164, statu
if err != nil {
return fmt.Errorf("Failed to determine if '%s' is subscribed: %w", src, err)
}
phone.Update(ctx, txn, &models.CommsPhoneSetter{
err = phone.Update(ctx, txn, &models.CommsPhoneSetter{
Status: omit.From(status),
})
if err != nil {
return fmt.Errorf("update phone status: %w", err)
}
log.Info().Str("src", src.PhoneString()).Str("status", string(status)).Msg("Set number subscribed")
return nil
}

View file

@ -159,7 +159,7 @@ func sendTextComplete(ctx context.Context, job *models.CommsTextJob) error {
if err != nil {
return fmt.Errorf("insert report_text: %w", err)
}
models.PublicreportReportLogs.Insert(&models.PublicreportReportLogSetter{
_, err = models.PublicreportReportLogs.Insert(&models.PublicreportReportLogSetter{
Created: omit.From(time.Now()),
EmailLogID: omitnull.FromPtr[int32](nil),
// ID
@ -168,6 +168,9 @@ func sendTextComplete(ctx context.Context, job *models.CommsTextJob) error {
Type: omit.From(enums.PublicreportReportlogtypeMessageText),
UserID: omitnull.From(creator_id),
}).One(ctx, txn)
if err != nil {
return fmt.Errorf("insert report log: %w", err)
}
report, err := models.FindPublicreportReport(ctx, txn, report_id)
if err != nil {
return fmt.Errorf("find public report: %w", err)

View file

@ -136,7 +136,7 @@ func respondText(ctx context.Context, log_id int32) error {
return fmt.Errorf("has open report: %w", err)
}
for _, report := range reports {
models.PublicreportReportLogs.Insert(&models.PublicreportReportLogSetter{
_, err = models.PublicreportReportLogs.Insert(&models.PublicreportReportLogSetter{
Created: omit.From(time.Now()),
EmailLogID: omitnull.FromPtr[int32](nil),
// ID
@ -145,6 +145,9 @@ func respondText(ctx context.Context, log_id int32) error {
Type: omit.From(enums.PublicreportReportlogtypeMessageText),
UserID: omitnull.FromPtr[int32](nil),
}).One(ctx, txn)
if err != nil {
return fmt.Errorf("insert report log: %w", err)
}
event.Updated(event.TypeRMOPublicReport, report.OrganizationID, report.PublicID)
}
// If humans are involved, wait for them.