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:
2026-04-23 20:39:50 -04:00
parent 065099cfc2
commit 2ee37c657c
7 changed files with 37 additions and 20 deletions
+4 -2
View File
@@ -147,10 +147,12 @@ func TestUpdateDevice(t *testing.T) {
device := setup.CreateDevice(t, "Test Device", "koreader", "test-device-123")
// Update device
syncEnabled := false
syncFreq := int32(10)
updateRequest := handlers.DeviceUpdateRequest{
DeviceName: "Updated Device Name",
SyncEnabled: new(false),
SyncFrequencyMinutes: new(int32(10)),
SyncEnabled: &syncEnabled,
SyncFrequencyMinutes: &syncFreq,
}
updateBody, _ := json.Marshal(updateRequest)