refactor: remove unnecessary type conversions and handle ignored errors across codebase

Remove redundant type conversions that Go 1.26 makes unnecessary or that
were already no-ops:

- uuid.UUID(x.Bytes) → x.Bytes (uuid.UUID is [16]byte, same as pgtype UUID Bytes)
- pgtype.UUID{Bytes: [16]byte(u), Valid: true} → pgtype.UUID{Bytes: u, Valid: true}
- (*time.Time)(&x.Time) → &x.Time
- json.RawMessage(x) → x where x is already []byte
- []byte(stringVal) → stringVal where []byte is expected
- int()/int64()/byte() casts on values already of the target type
- Decompressor(fn) → fn (type is identical)

Handle previously ignored error returns:

- collections.go: check json.Unmarshal error in GetCollection
- conversion_service.go: check fileSize.Scan() error
- app_test.go: check app.Shutdown() error in benchmark
This commit is contained in:
2026-04-21 21:15:59 -04:00
parent ad27902790
commit e389df92c3
23 changed files with 85 additions and 75 deletions
+2 -2
View File
@@ -544,7 +544,7 @@ func (h *KOReaderHandler) updateProgressForBook(c *echo.Context, userID pgtype.U
}
h.connManager.BroadcastProgressUpdate(
uuid.UUID(mediaItemID.Bytes),
mediaItemID.Bytes,
book.Percentage,
wsync.SourceDevice{
ID: uuid.UUID(userID.Bytes).String(),
@@ -608,7 +608,7 @@ func (h *KOReaderHandler) GetMetadata(c *echo.Context) error {
progressData.ChapterProgress = new(progress.ChapterProgress.Float64)
}
if progress.CharacterOffset.Valid {
progressData.Character = new(int64(progress.CharacterOffset.Int64))
progressData.Character = new(progress.CharacterOffset.Int64)
}
if progress.CurrentPage.Valid {
progressData.Page = new(int(progress.CurrentPage.Int32))