Skip to content

Commit a0f24a9

Browse files
committed
Fix lint errors
1 parent 479c22c commit a0f24a9

File tree

18 files changed

+85
-87
lines changed

18 files changed

+85
-87
lines changed

internal/client/file.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ func (s *fileService) Info(ctx context.Context, uuid string, includeAppData bool
7575

7676
func mapFileInfo(info file.Info) *service.File {
7777
f := &service.File{
78-
UUID: info.BasicFileInfo.ID,
79-
Size: int64(info.BasicFileInfo.Size),
80-
Filename: info.BasicFileInfo.OriginalFileName,
81-
MimeType: info.BasicFileInfo.MimeType,
82-
IsImage: info.BasicFileInfo.IsImage,
83-
IsReady: info.BasicFileInfo.IsReady,
78+
UUID: info.ID,
79+
Size: int64(info.Size),
80+
Filename: info.OriginalFileName,
81+
MimeType: info.MimeType,
82+
IsImage: info.IsImage,
83+
IsReady: info.IsReady,
8484
IsStored: info.StoredAt != nil,
8585
URL: info.URL,
8686
Metadata: info.Metadata,
@@ -114,12 +114,12 @@ func mapFileInfo(info file.Info) *service.File {
114114

115115
func mapUploadFileInfo(info upload.FileInfo) *service.File {
116116
return &service.File{
117-
UUID: info.BasicFileInfo.ID,
118-
Size: int64(info.BasicFileInfo.Size),
119-
Filename: info.BasicFileInfo.OriginalFileName,
120-
MimeType: info.BasicFileInfo.MimeType,
121-
IsImage: info.BasicFileInfo.IsImage,
122-
IsReady: info.BasicFileInfo.IsReady,
117+
UUID: info.ID,
118+
Size: int64(info.Size),
119+
Filename: info.OriginalFileName,
120+
MimeType: info.MimeType,
121+
IsImage: info.IsImage,
122+
IsReady: info.IsReady,
123123
IsStored: info.IsStored,
124124
}
125125
}
@@ -236,7 +236,7 @@ func (s *fileService) Upload(ctx context.Context, params service.UploadParams) (
236236

237237
// The upload API returns only basic fields (no timestamps, URLs, or
238238
// metadata). Fetch the complete file info from the REST API.
239-
return s.enrichUploadInfo(ctx, uploadInfo.BasicFileInfo.ID, mapUploadFileInfo(uploadInfo)), nil
239+
return s.enrichUploadInfo(ctx, uploadInfo.ID, mapUploadFileInfo(uploadInfo)), nil
240240
}
241241

242242
func (s *fileService) UploadFromURL(ctx context.Context, params service.URLUploadParams) (*service.File, error) {
@@ -280,14 +280,14 @@ func (s *fileService) UploadFromURL(ctx context.Context, params service.URLUploa
280280
info, ok := res.Info()
281281
if ok {
282282
s.verbose.Info("from-url", "completed synchronously")
283-
return s.enrichUploadInfo(ctx, info.BasicFileInfo.ID, mapUploadFileInfo(info)), nil
283+
return s.enrichUploadInfo(ctx, info.ID, mapUploadFileInfo(info)), nil
284284
}
285285

286286
s.verbose.Infof("from-url: waiting for async processing (timeout %s)", timeout)
287287
select {
288288
case info = <-res.Done():
289289
s.verbose.Info("from-url", "async processing complete")
290-
return s.enrichUploadInfo(ctx, info.BasicFileInfo.ID, mapUploadFileInfo(info)), nil
290+
return s.enrichUploadInfo(ctx, info.ID, mapUploadFileInfo(info)), nil
291291
case err = <-res.Error():
292292
return nil, err
293293
case <-ctx.Done():

internal/client/file_test.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,17 @@ import (
1212
)
1313

1414
func TestNewFileService(t *testing.T) {
15-
svc, err := NewFileService("test-pub-key", "test-secret-key", "", nil, nil)
15+
_, err := NewFileService("test-pub-key", "test-secret-key", "", nil, nil)
1616
if err != nil {
1717
t.Fatalf("NewFileService failed: %v", err)
1818
}
19-
var _ service.FileService = svc
2019
}
2120

2221
func TestNewFileService_WithCDNBase(t *testing.T) {
23-
svc, err := NewFileService("test-pub-key", "test-secret-key", "https://custom.example.com", nil, nil)
22+
_, err := NewFileService("test-pub-key", "test-secret-key", "https://custom.example.com", nil, nil)
2423
if err != nil {
2524
t.Fatalf("NewFileService with CDN base failed: %v", err)
2625
}
27-
var _ service.FileService = svc
2826
}
2927

3028
func TestSetCDNURL_RewritesOriginalFileURL(t *testing.T) {
@@ -106,7 +104,7 @@ func TestMapFileInfo_Complete(t *testing.T) {
106104
}`
107105
w.Header().Set("Content-Type", "application/json")
108106
w.WriteHeader(200)
109-
w.Write([]byte(resp))
107+
_, _ = w.Write([]byte(resp))
110108
}))
111109
defer server.Close()
112110

internal/client/group.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,12 @@ func mapUploadGroupInfo(info upload.GroupInfo) *service.Group {
164164
}
165165
for _, f := range info.Files {
166166
g.Files = append(g.Files, service.File{
167-
UUID: f.BasicFileInfo.ID,
168-
Size: int64(f.BasicFileInfo.Size),
169-
Filename: f.BasicFileInfo.OriginalFileName,
170-
MimeType: f.BasicFileInfo.MimeType,
171-
IsImage: f.BasicFileInfo.IsImage,
172-
IsReady: f.BasicFileInfo.IsReady,
167+
UUID: f.ID,
168+
Size: int64(f.Size),
169+
Filename: f.OriginalFileName,
170+
MimeType: f.MimeType,
171+
IsImage: f.IsImage,
172+
IsReady: f.IsReady,
173173
IsStored: f.IsStored,
174174
})
175175
}

internal/cmd/addon.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ JSON fields (after completion): status, result.`,
147147
"status": "would execute",
148148
})
149149
}
150-
fmt.Fprintf(cmd.OutOrStdout(), "Would execute %s on %s\n", addonName, fileUUID)
150+
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "Would execute %s on %s\n", addonName, fileUUID)
151151
return nil
152152
}
153153

@@ -160,7 +160,7 @@ JSON fields (after completion): status, result.`,
160160
if opts.JSON {
161161
return formatter.Format(cmd.OutOrStdout(), result)
162162
}
163-
fmt.Fprintf(cmd.OutOrStdout(), "Request ID: %s\n", result.RequestID)
163+
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "Request ID: %s\n", result.RequestID)
164164
return nil
165165
}
166166

@@ -173,9 +173,9 @@ JSON fields (after completion): status, result.`,
173173
return formatter.Format(cmd.OutOrStdout(), status)
174174
}
175175

176-
fmt.Fprintf(cmd.OutOrStdout(), "Status: %s\n", status.Status)
176+
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "Status: %s\n", status.Status)
177177
if len(status.Result) > 0 {
178-
fmt.Fprintf(cmd.OutOrStdout(), "Result: %s\n", string(status.Result))
178+
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "Result: %s\n", string(status.Result))
179179
}
180180
return nil
181181
},
@@ -235,9 +235,9 @@ JSON fields: status, result (when done).`,
235235
return formatter.Format(cmd.OutOrStdout(), status)
236236
}
237237

238-
fmt.Fprintf(cmd.OutOrStdout(), "Status: %s\n", status.Status)
238+
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "Status: %s\n", status.Status)
239239
if len(status.Result) > 0 {
240-
fmt.Fprintf(cmd.OutOrStdout(), "Result: %s\n", string(status.Result))
240+
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "Result: %s\n", string(status.Result))
241241
}
242242
return nil
243243
},

internal/cmd/convert.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ JSON fields (after completion): status, result.`,
115115
"status": "would convert",
116116
})
117117
}
118-
fmt.Fprintf(cmd.OutOrStdout(), "Would convert %s to %s\n", uuid, format)
118+
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "Would convert %s to %s\n", uuid, format)
119119
return nil
120120
}
121121

@@ -128,7 +128,7 @@ JSON fields (after completion): status, result.`,
128128
if opts.JSON {
129129
return formatter.Format(cmd.OutOrStdout(), result)
130130
}
131-
fmt.Fprintf(cmd.OutOrStdout(), "Token: %s\nUUID: %s\n", result.Token, result.UUID)
131+
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "Token: %s\nUUID: %s\n", result.Token, result.UUID)
132132
return nil
133133
}
134134

@@ -144,7 +144,7 @@ JSON fields (after completion): status, result.`,
144144
})
145145
}
146146

147-
fmt.Fprintf(cmd.OutOrStdout(), "Status: %s\nResult: %s\n", status.Status, status.ResultURL)
147+
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "Status: %s\nResult: %s\n", status.Status, status.ResultURL)
148148
return nil
149149
},
150150
}
@@ -259,7 +259,7 @@ JSON fields (after completion): status, result.`,
259259
"status": "would convert",
260260
})
261261
}
262-
fmt.Fprintf(cmd.OutOrStdout(), "Would convert video %s\n", uuid)
262+
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "Would convert video %s\n", uuid)
263263
return nil
264264
}
265265

@@ -272,7 +272,7 @@ JSON fields (after completion): status, result.`,
272272
if opts.JSON {
273273
return formatter.Format(cmd.OutOrStdout(), result)
274274
}
275-
fmt.Fprintf(cmd.OutOrStdout(), "Token: %s\nUUID: %s\n", result.Token, result.UUID)
275+
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "Token: %s\nUUID: %s\n", result.Token, result.UUID)
276276
return nil
277277
}
278278

@@ -288,7 +288,7 @@ JSON fields (after completion): status, result.`,
288288
})
289289
}
290290

291-
fmt.Fprintf(cmd.OutOrStdout(), "Status: %s\nResult: %s\n", status.Status, status.ResultURL)
291+
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "Status: %s\nResult: %s\n", status.Status, status.ResultURL)
292292
return nil
293293
},
294294
}

internal/cmd/file_batch.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ func runBatchCommand(
210210
if len(merged.Problems) > 0 {
211211
warn := color.New(color.FgYellow)
212212
for uuid, problem := range merged.Problems {
213-
fmt.Fprintf(cmd.ErrOrStderr(), "%s %s: %s\n", warn.Sprint("problem:"), uuid, problem)
213+
_, _ = fmt.Fprintf(cmd.ErrOrStderr(), "%s %s: %s\n", warn.Sprint("problem:"), uuid, problem)
214214
}
215215
return ExitErrorf(1, "%d problems encountered", len(merged.Problems))
216216
}

internal/cmd/file_upload.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,13 @@ is_ready, datetime_uploaded, original_file_url, metadata.`,
190190
Metadata: meta,
191191
MultipartThreshold: threshold,
192192
})
193-
f.Close()
193+
_ = f.Close()
194194
if err != nil {
195195
return fmt.Errorf("uploading %q: %w", entry.path, err)
196196
}
197197

198198
if showProgress {
199-
fmt.Fprintln(cmd.ErrOrStderr())
199+
_, _ = fmt.Fprintln(cmd.ErrOrStderr())
200200
}
201201

202202
results = append(results, result)
@@ -280,7 +280,7 @@ func detectContentType(path string) (string, error) {
280280
if err != nil {
281281
return "", err
282282
}
283-
defer f.Close()
283+
defer func() { _ = f.Close() }()
284284

285285
buf := make([]byte, 512)
286286
n, err := f.Read(buf)
@@ -314,7 +314,7 @@ func (p *progressReader) Read(buf []byte) (int, error) {
314314
if n > 0 {
315315
current := p.read.Add(int64(n))
316316
pct := float64(current) / float64(p.total) * 100
317-
fmt.Fprintf(p.w, "\r%s: %.1f%% (%d/%d bytes)", p.label, pct, current, p.total)
317+
_, _ = fmt.Fprintf(p.w, "\r%s: %.1f%% (%d/%d bytes)", p.label, pct, current, p.total)
318318
}
319319
return n, err
320320
}

internal/cmd/group.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ JSON fields: id, files_count, datetime_created, cdn_url.`,
264264
"status": "would create",
265265
})
266266
}
267-
fmt.Fprintf(cmd.OutOrStdout(), "Would create group with %d file(s)\n", len(uuids))
267+
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "Would create group with %d file(s)\n", len(uuids))
268268
return nil
269269
}
270270

@@ -344,7 +344,7 @@ JSON fields: id, status.`,
344344
"status": "would delete",
345345
})
346346
}
347-
fmt.Fprintf(cmd.OutOrStdout(), "Would delete group %s (%d files)\n", g.ID, g.FilesCount)
347+
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "Would delete group %s (%d files)\n", g.ID, g.FilesCount)
348348
return nil
349349
}
350350

@@ -359,7 +359,7 @@ JSON fields: id, status.`,
359359
})
360360
}
361361

362-
fmt.Fprintf(cmd.OutOrStdout(), "Deleted group %s\n", groupID)
362+
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "Deleted group %s\n", groupID)
363363
return nil
364364
},
365365
}

internal/cmd/metadata.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ is specified. Returns "No metadata found" when the file has no metadata.`,
7373
}
7474

7575
if len(meta) == 0 {
76-
fmt.Fprintln(cmd.OutOrStdout(), "No metadata found")
76+
_, _ = fmt.Fprintln(cmd.OutOrStdout(), "No metadata found")
7777
return nil
7878
}
7979

@@ -133,7 +133,7 @@ fields when --json all is specified. Returns an error if the key does not exist.
133133
})
134134
}
135135

136-
fmt.Fprintln(cmd.OutOrStdout(), value)
136+
_, _ = fmt.Fprintln(cmd.OutOrStdout(), value)
137137
return nil
138138
},
139139
}
@@ -199,7 +199,7 @@ new_value, status.`,
199199
"status": "would set",
200200
})
201201
}
202-
fmt.Fprintf(cmd.OutOrStdout(), "Would set %s: %q -> %q\n", key, current, value)
202+
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "Would set %s: %q -> %q\n", key, current, value)
203203
return nil
204204
}
205205

@@ -214,7 +214,7 @@ new_value, status.`,
214214
})
215215
}
216216

217-
fmt.Fprintf(cmd.OutOrStdout(), "Set %s = %q\n", key, value)
217+
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "Set %s = %q\n", key, value)
218218
return nil
219219
},
220220
}
@@ -278,7 +278,7 @@ JSON fields (--json): key, status. With --dry-run: key, value, status.`,
278278
"status": "would delete",
279279
})
280280
}
281-
fmt.Fprintf(cmd.OutOrStdout(), "Would delete %s (current value: %q)\n", key, value)
281+
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "Would delete %s (current value: %q)\n", key, value)
282282
return nil
283283
}
284284

@@ -293,7 +293,7 @@ JSON fields (--json): key, status. With --dry-run: key, value, status.`,
293293
})
294294
}
295295

296-
fmt.Fprintf(cmd.OutOrStdout(), "Deleted %s\n", key)
296+
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "Deleted %s\n", key)
297297
return nil
298298
},
299299
}

internal/cmd/schema.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ No authentication required.`,
8787
enc := json.NewEncoder(cmd.OutOrStdout())
8888
enc.SetEscapeHTML(false)
8989
enc.SetIndent("", " ")
90-
enc.Encode(schema)
90+
_ = enc.Encode(schema)
9191
},
9292
}
9393
}

0 commit comments

Comments
 (0)