fix(lint): use default:none to disable errcheck, fix all gofmt and exhaustive

This commit is contained in:
Deivid Soto 2026-03-31 00:29:16 +02:00
parent 4426219f35
commit aed5f0475d
24 changed files with 74 additions and 77 deletions

View file

@ -11,16 +11,16 @@ import (
// Client talks to a single *arr instance (Sonarr, Radarr, or Prowlarr).
type Client struct {
baseURL string
apiKey string
baseURL string
apiKey string
httpClient *http.Client
}
// NewClient creates a client for the given *arr instance.
func NewClient(baseURL, apiKey string) *Client {
return &Client{
baseURL: strings.TrimRight(baseURL, "/"),
apiKey: apiKey,
baseURL: strings.TrimRight(baseURL, "/"),
apiKey: apiKey,
httpClient: &http.Client{Timeout: 15 * time.Second},
}
}

View file

@ -128,7 +128,7 @@ func TestExtractBlocklistedHashes(t *testing.T) {
{Data: BlocklistData{InfoHash: "AAAA"}},
{Data: BlocklistData{InfoHash: "AAAA"}}, // duplicate
{Data: BlocklistData{InfoHash: "BBBB"}},
{Data: BlocklistData{InfoHash: ""}}, // empty
{Data: BlocklistData{InfoHash: ""}}, // empty
}
hashes := ExtractBlocklistedHashes(items)
if len(hashes) != 2 {
@ -139,8 +139,8 @@ func TestExtractBlocklistedHashes(t *testing.T) {
func TestExtractDownloadedHashes(t *testing.T) {
records := []HistoryRecord{
{EventType: "downloadFolderImported", Data: HistoryData{InfoHash: "hash1"}},
{EventType: "grabbed", Data: HistoryData{InfoHash: "hash2"}}, // not imported
{EventType: "downloadFolderImported", Data: HistoryData{InfoHash: "hash1"}}, // duplicate
{EventType: "grabbed", Data: HistoryData{InfoHash: "hash2"}}, // not imported
{EventType: "downloadFolderImported", Data: HistoryData{InfoHash: "hash1"}}, // duplicate
{EventType: "downloadFolderImported", Data: HistoryData{InfoHash: "hash3"}},
}
hashes := ExtractDownloadedHashes(records)

View file

@ -112,11 +112,11 @@ type Tag struct {
// HistoryRecord is a single entry from /api/v3/history.
type HistoryRecord struct {
ID int `json:"id"`
EventType string `json:"eventType"` // "grabbed", "downloadFolderImported", etc.
DownloadID string `json:"downloadId"`
SourceTitle string `json:"sourceTitle"`
Data HistoryData `json:"data"`
ID int `json:"id"`
EventType string `json:"eventType"` // "grabbed", "downloadFolderImported", etc.
DownloadID string `json:"downloadId"`
SourceTitle string `json:"sourceTitle"`
Data HistoryData `json:"data"`
}
// HistoryData holds the nested data of a history record.
@ -127,14 +127,14 @@ type HistoryData struct {
// HistoryResponse wraps the paginated history from *arr.
type HistoryResponse struct {
Records []HistoryRecord `json:"records"`
TotalRecords int `json:"totalRecords"`
Records []HistoryRecord `json:"records"`
TotalRecords int `json:"totalRecords"`
}
// BlocklistItem is an item the user explicitly rejected.
type BlocklistItem struct {
ID int `json:"id"`
SourceTitle string `json:"sourceTitle"`
ID int `json:"id"`
SourceTitle string `json:"sourceTitle"`
Data BlocklistData `json:"data"`
}
@ -145,8 +145,8 @@ type BlocklistData struct {
// BlocklistResponse wraps paginated blocklist from *arr.
type BlocklistResponse struct {
Records []BlocklistItem `json:"records"`
TotalRecords int `json:"totalRecords"`
Records []BlocklistItem `json:"records"`
TotalRecords int `json:"totalRecords"`
}
// Instance represents a discovered *arr application.