lint: fix remaining errcheck for Write, Fprintf, Rollback, Commit
- Use lint.Write for unchecked w.Write in handlerJSONPost/Put, report - Use lint.Fprintf for fmt.Fprintf in twilio handlers - Use lint.LogOnErrRollback for deferred Rollbacks in compliance, lead, note - Check errors from txn.Commit in lead, note - Use lint.LogOnErrCtx for addError calls in flyover
This commit is contained in:
parent
679d12b48f
commit
808e172221
7 changed files with 36 additions and 18 deletions
|
|
@ -14,6 +14,7 @@ import (
|
|||
"github.com/Gleipnir-Technology/bob/dialect/psql/um"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/db"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/db/enums"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/lint"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/db/models"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/h3utils"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/platform/file"
|
||||
|
|
@ -191,19 +192,25 @@ func insertFlyover(ctx context.Context, txn bob.Tx, file *models.FileuploadFile,
|
|||
if err == nil {
|
||||
setter.Condition = omit.From(condition)
|
||||
} else {
|
||||
addError(ctx, txn, c, int32(line_number), int32(i), fmt.Sprintf("'%s' is not a pool condition that we recognize. It should be one of %s", value, poolConditionValidValues()))
|
||||
lint.LogOnErrCtx(func(ctx context.Context) error {
|
||||
return addError(ctx, txn, c, int32(line_number), int32(i), fmt.Sprintf("'%s' is not a pool condition that we recognize. It should be one of %s", value, poolConditionValidValues()))
|
||||
}, ctx, "add pool condition error")
|
||||
continue
|
||||
}
|
||||
case headerFlyoverLatitude:
|
||||
lat, err = strconv.ParseFloat(value, 10)
|
||||
if err != nil {
|
||||
addError(ctx, txn, c, int32(line_number), int32(i), fmt.Sprintf("'%s' is not decimal value", value))
|
||||
lint.LogOnErrCtx(func(ctx context.Context) error {
|
||||
return addError(ctx, txn, c, int32(line_number), int32(i), fmt.Sprintf("'%s' is not decimal value", value))
|
||||
}, ctx, "add lat error")
|
||||
continue
|
||||
}
|
||||
case headerFlyoverLongitude:
|
||||
lng, err = strconv.ParseFloat(value, 10)
|
||||
if err != nil {
|
||||
addError(ctx, txn, c, int32(line_number), int32(i), fmt.Sprintf("'%s' is not decimal value", value))
|
||||
lint.LogOnErrCtx(func(ctx context.Context) error {
|
||||
return addError(ctx, txn, c, int32(line_number), int32(i), fmt.Sprintf("'%s' is not decimal value", value))
|
||||
}, ctx, "add lng error")
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue