From 6dd8e441d1a3f11e25a95e5c9695198b2fafef70 Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Fri, 27 Feb 2026 17:09:05 -0500 Subject: [PATCH] style: fix code alignment and indentation consistency - Correct indentation in goroutine leak test setup block - Align struct field tags in BookMatch and all matching methods for consistent column-style formatting (media_item_id, bookhoard_uuid, confidence, match_method) - Improves code readability and adheres to project indentation guidelines --- cmd/server/tests/goroutine_leak_test.go | 2 +- internal/services/book_matching.go | 54 ++++++++++++------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/cmd/server/tests/goroutine_leak_test.go b/cmd/server/tests/goroutine_leak_test.go index 684812a..69f4174 100644 --- a/cmd/server/tests/goroutine_leak_test.go +++ b/cmd/server/tests/goroutine_leak_test.go @@ -18,7 +18,7 @@ func TestGoroutineCleanup(t *testing.T) { t.Logf("Initial goroutine count: %d", initialGoroutines) // Start server -setup := setupTestServer(t) + setup := setupTestServer(t) defer setup.Close() // Wait for startup diff --git a/internal/services/book_matching.go b/internal/services/book_matching.go index 6f99537..4fb5f4d 100644 --- a/internal/services/book_matching.go +++ b/internal/services/book_matching.go @@ -12,10 +12,10 @@ import ( // BookMatch represents a potential match with confidence score type BookMatch struct { - MediaItemID uuid.UUID `json:"media_item_id"` + MediaItemID uuid.UUID `json:"media_item_id"` BookhoardUUID uuid.UUID `json:"bookhoard_uuid"` - Confidence float64 `json:"confidence"` - MatchMethod string `json:"match_method"` + Confidence float64 `json:"confidence"` + MatchMethod string `json:"match_method"` } // BookQueryRequest represents a book query from a device @@ -128,10 +128,10 @@ func (s *BookMatchingService) matchByBookhoardUUID(ctx context.Context, identifi if err == nil { mediaUUID := item.ID.Bytes return &BookMatch{ - MediaItemID: mediaUUID, + MediaItemID: mediaUUID, BookhoardUUID: mediaUUID, - Confidence: 1.0, - MatchMethod: "uuid_match", + Confidence: 1.0, + MatchMethod: "uuid_match", } } } @@ -155,10 +155,10 @@ func (s *BookMatchingService) matchByOPFUUID(ctx context.Context, identifiers [] for _, item := range items { if item.OpfUuid.Valid && item.OpfUuid.String == uuidStr { return &BookMatch{ - MediaItemID: item.ID.Bytes, + MediaItemID: item.ID.Bytes, BookhoardUUID: item.ID.Bytes, - Confidence: 0.95, - MatchMethod: "opf_uuid_match", + Confidence: 0.95, + MatchMethod: "opf_uuid_match", } } } @@ -180,10 +180,10 @@ func (s *BookMatchingService) matchBySHA256(ctx context.Context, sha256 string) for _, item := range items { if item.FileSha256.Valid && item.FileSha256.String == sha256 { return &BookMatch{ - MediaItemID: item.ID.Bytes, + MediaItemID: item.ID.Bytes, BookhoardUUID: item.ID.Bytes, - Confidence: 0.9, - MatchMethod: "sha256_match", + Confidence: 0.9, + MatchMethod: "sha256_match", } } } @@ -206,10 +206,10 @@ func (s *BookMatchingService) matchByOPFIdentifier(ctx context.Context, identifi for _, item := range items { if item.OpfIdentifier.Valid && item.OpfIdentifier.String == identifier { return &BookMatch{ - MediaItemID: item.ID.Bytes, + MediaItemID: item.ID.Bytes, BookhoardUUID: item.ID.Bytes, - Confidence: 0.85, - MatchMethod: "opf_identifier_match", + Confidence: 0.85, + MatchMethod: "opf_identifier_match", } } } @@ -234,10 +234,10 @@ func (s *BookMatchingService) matchByISBNASIN(ctx context.Context, identifiers [ for _, item := range items { if item.Isbn.Valid && item.Isbn.String == isbn { return &BookMatch{ - MediaItemID: item.ID.Bytes, + MediaItemID: item.ID.Bytes, BookhoardUUID: item.ID.Bytes, - Confidence: 0.8, - MatchMethod: "isbn_match", + Confidence: 0.8, + MatchMethod: "isbn_match", } } } @@ -256,10 +256,10 @@ func (s *BookMatchingService) matchByISBNASIN(ctx context.Context, identifiers [ for _, item := range items { if item.Asin.Valid && item.Asin.String == asin { return &BookMatch{ - MediaItemID: item.ID.Bytes, + MediaItemID: item.ID.Bytes, BookhoardUUID: item.ID.Bytes, - Confidence: 0.8, - MatchMethod: "asin_match", + Confidence: 0.8, + MatchMethod: "asin_match", } } } @@ -292,10 +292,10 @@ func (s *BookMatchingService) matchByTitleAuthorSize(ctx context.Context, title, if titleMatch && authorMatch && sizeMatch { matches = append(matches, BookMatch{ - MediaItemID: item.ID.Bytes, + MediaItemID: item.ID.Bytes, BookhoardUUID: item.ID.Bytes, - Confidence: 0.5, - MatchMethod: "title_author_size_match", + Confidence: 0.5, + MatchMethod: "title_author_size_match", }) } } @@ -318,10 +318,10 @@ func (s *BookMatchingService) matchByTitleOnly(ctx context.Context, title string for _, item := range items { if item.Title == title { matches = append(matches, BookMatch{ - MediaItemID: item.ID.Bytes, + MediaItemID: item.ID.Bytes, BookhoardUUID: item.ID.Bytes, - Confidence: 0.3, - MatchMethod: "title_match", + Confidence: 0.3, + MatchMethod: "title_match", }) } }