Skip to content

Commit 9cb9043

Browse files
committed
Style
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
1 parent b6fdabc commit 9cb9043

2 files changed

Lines changed: 24 additions & 24 deletions

File tree

client.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ func (c *Client) ShowPaste(
242242
if err != nil {
243243
return nil, fmt.Errorf("cannot execute http request: %w", err)
244244
}
245-
defer res.Body.Close()
245+
defer func() { _ = res.Body.Close() }()
246246

247247
var pasteResponse showPasteResponse
248248

@@ -441,7 +441,7 @@ func (c *Client) CreatePaste(
441441
if err != nil {
442442
return nil, fmt.Errorf("cannot execute http request: %w", err)
443443
}
444-
defer res.Body.Close()
444+
defer func() { _ = res.Body.Close() }()
445445

446446
pasteResponse := createPasteResponse{}
447447
err = json.NewDecoder(res.Body).Decode(&pasteResponse)
@@ -531,7 +531,7 @@ func decrypt(masterKey []byte, ct string, adata []byte, spec Spec) ([]byte, erro
531531
case CompressionAlgorithmGZip:
532532
buf := bytes.NewBuffer(cipherText)
533533
fr := flate.NewReader(buf)
534-
defer fr.Close()
534+
defer func() { _ = fr.Close() }()
535535
cipherText, err = io.ReadAll(fr)
536536
if err != nil {
537537
return nil, fmt.Errorf("cannot read gzip: %w", err)

cmd/privatebin/main.go

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ var (
209209

210210
switch output {
211211
case "":
212-
fmt.Fprintf(os.Stdout, "%s\n", result.Paste.Data)
212+
_, _ = fmt.Fprintf(os.Stdout, "%s\n", result.Paste.Data)
213213
case "json":
214214
var comments []map[string]string
215215
for _, comment := range result.Comments {
@@ -225,18 +225,18 @@ var (
225225
)
226226
}
227227

228-
json.NewEncoder(os.Stdout).Encode(
229-
map[string]any{
230-
"paste_id": result.PasteID,
231-
"paste": map[string]string{
232-
"attachment_name": result.Paste.AttachmentName,
233-
"attachment": base64.StdEncoding.EncodeToString(result.Paste.Attachment),
234-
"data": base64.StdEncoding.EncodeToString(result.Paste.Data),
235-
},
236-
"comment_count": result.CommentCount,
237-
"comments": comments,
228+
_ = json.NewEncoder(os.Stdout).Encode(
229+
map[string]any{
230+
"paste_id": result.PasteID,
231+
"paste": map[string]string{
232+
"attachment_name": result.Paste.AttachmentName,
233+
"attachment": base64.StdEncoding.EncodeToString(result.Paste.Attachment),
234+
"data": base64.StdEncoding.EncodeToString(result.Paste.Data),
238235
},
239-
)
236+
"comment_count": result.CommentCount,
237+
"comments": comments,
238+
},
239+
)
240240
}
241241
return nil
242242
},
@@ -323,15 +323,15 @@ var (
323323

324324
switch output {
325325
case "":
326-
fmt.Fprintf(os.Stdout, "%s\n", result.PasteURL.String())
326+
_, _ = fmt.Fprintf(os.Stdout, "%s\n", result.PasteURL.String())
327327
case "json":
328-
json.NewEncoder(os.Stdout).Encode(
329-
map[string]any{
330-
"paste_id": result.PasteID,
331-
"paste_url": result.PasteURL.String(),
332-
"delete_token": result.DeleteToken,
333-
},
334-
)
328+
_ = json.NewEncoder(os.Stdout).Encode(
329+
map[string]any{
330+
"paste_id": result.PasteID,
331+
"paste_url": result.PasteURL.String(),
332+
"delete_token": result.DeleteToken,
333+
},
334+
)
335335
}
336336

337337
return nil
@@ -389,7 +389,7 @@ var (
389389
return fmt.Errorf("cannot write configuration file: %w", err)
390390
}
391391

392-
fmt.Fprintf(os.Stdout, "%s\n", cfgPath)
392+
_, _ = fmt.Fprintf(os.Stdout, "%s\n", cfgPath)
393393

394394
return nil
395395
},

0 commit comments

Comments
 (0)