fix: replace invalid new(expression) calls with proper pointer allocation
Go's new() builtin takes a type and allocates a zero value — it cannot wrap an expression. All instances of new(someExpression) were compile errors. Replace each with a local variable assignment and address-of operator. Affected files: - handlers/koreader.go: progress field pointers (Chapter, Page, etc.) - handlers/kobo.go: pagesRemaining pointer - handlers/queue.go: uuidPtrToString and timestamptzPtrToString helpers - router/reader.go: bookmark pageNumber and chapterNumber pointers - services/media_scanner.go: validation error message pointers - services/worker.go: StartedAt and CompletedAt timestamps - sync/offline.go: GetDeviceStatus return pointer - tests/device_test.go: SyncEnabled and SyncFrequencyMinutes pointers
This commit is contained in:
@@ -310,7 +310,8 @@ func uuidPtrToString(u pgtype.UUID) *string {
|
||||
if !u.Valid {
|
||||
return nil
|
||||
}
|
||||
return new(uuid.UUID(u.Bytes).String())
|
||||
s := uuid.UUID(u.Bytes).String()
|
||||
return &s
|
||||
}
|
||||
|
||||
func textPtrToString(t pgtype.Text) *string {
|
||||
@@ -324,5 +325,6 @@ func timestamptzPtrToString(t pgtype.Timestamptz) *string {
|
||||
if !t.Valid {
|
||||
return nil
|
||||
}
|
||||
return new(t.Time.Format("2006-01-02T15:04:05Z07:00"))
|
||||
timeFormat := t.Time.Format("2006-01-02T15:04:05Z07:00")
|
||||
return &timeFormat
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user