refactor(handlers): replace temporary variable pointer pattern with new() builtin

Simplify pointer creation across kobo, koreader, and queue handlers by
replacing the two-step pattern (assign to local, then take address) with
inline new() calls. This reduces verbosity without changing behavior:

Before:
  remaining := int(a - b)
  pagesRemaining = &remaining

After:
  pagesRemaining = new(int(a - b))

Covers page calculations, chapter/progress fields, UUID formatting,
and timestamp string conversions.
This commit is contained in:
2026-04-20 08:57:42 -04:00
parent 45df899889
commit 8ac6e1ac79
3 changed files with 9 additions and 18 deletions
+2 -4
View File
@@ -310,8 +310,7 @@ func uuidPtrToString(u pgtype.UUID) *string {
if !u.Valid {
return nil
}
s := uuid.UUID(u.Bytes).String()
return &s
return new(uuid.UUID(u.Bytes).String())
}
func textPtrToString(t pgtype.Text) *string {
@@ -325,6 +324,5 @@ func timestamptzPtrToString(t pgtype.Timestamptz) *string {
if !t.Valid {
return nil
}
s := t.Time.Format("2006-01-02T15:04:05Z07:00")
return &s
return new(t.Time.Format("2006-01-02T15:04:05Z07:00"))
}