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:
@@ -221,7 +221,8 @@ func (w *Worker) processJob(job *Job) {
|
||||
}
|
||||
w.mu.Unlock()
|
||||
|
||||
job.StartedAt = new(time.Now())
|
||||
started := time.Now()
|
||||
job.StartedAt = &started
|
||||
|
||||
w.mu.Lock()
|
||||
if result, exists := w.results[job.ID]; exists {
|
||||
@@ -253,7 +254,8 @@ func (w *Worker) processJob(job *Job) {
|
||||
err = fmt.Errorf("unknown job type: %s", job.Type)
|
||||
}
|
||||
|
||||
job.CompletedAt = new(time.Now())
|
||||
completed := time.Now()
|
||||
job.CompletedAt = &completed
|
||||
job.Error = err
|
||||
job.Result = result
|
||||
|
||||
|
||||
Reference in New Issue
Block a user