Skip to content

Commit 6421741

Browse files
committed
Fix new lint errors
1 parent 7d3d428 commit 6421741

4 files changed

Lines changed: 7 additions & 9 deletions

File tree

cmd/formats/download/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ func getImageWithPolicy(client *http.Client, ctx context.Context, path md.Path,
234234
}
235235

236236
img, _, err := image.Decode(resp.Body)
237-
defer resp.Body.Close()
237+
defer resp.Body.Close() //nolint:errcheck
238238

239239
if err != nil && policy == DataSaverPolicyFallback {
240240
return getImageWithPolicy(client, ctx, path, DataSaverPolicyPrefer)

cmd/formats/kindle/filesystem.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,22 +58,20 @@ func (n *NormalizedDirectory) Write(identifier md.Identifier, mobi mobi.Book, p
5858
if err != nil {
5959
return fmt.Errorf("create: %w", err)
6060
}
61+
defer f.Close() //nolint:errcheck
6162
if err := mobi.Realize().Write(p.NewProxyWriter(f)); err != nil {
62-
f.Close()
6363
return fmt.Errorf("write: %w", err)
6464
}
65-
f.Close()
6665

6766
if n.thumbnailDirectory != "" && mobi.CoverImage != nil {
6867
f, err := create(path.Join(n.thumbnailDirectory, mobi.GetThumbFilename()))
6968
if err != nil {
7069
return fmt.Errorf("create: %w", err)
7170
}
71+
defer f.Close() //nolint:errcheck
7272
if err := jpeg.Encode(p.NewProxyWriter(f), mobi.CoverImage, nil); err != nil {
73-
f.Close()
7473
return fmt.Errorf("write: %w", err)
7574
}
76-
f.Close()
7775
}
7876

7977
return nil

cmd/help.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ func writeHelp(cmd *cobra.Command, w io.Writer) {
3939
return result
4040
}
4141

42-
fmt.Fprintf(w, "Usage:\n %v\n", cmd.Use)
42+
fmt.Fprintf(w, "Usage:\n %v\n", cmd.Use) //nolint:errcheck
4343
for _, name := range keys(groups) {
44-
fmt.Fprintf(w, "\n%v:\n", name[1:])
44+
fmt.Fprintf(w, "\n%v:\n", name[1:]) //nolint:errcheck
4545
for _, f := range groups[name] {
4646
shorthand := ""
4747
if len(f.Shorthand) > 0 {
4848
shorthand = "-" + f.Shorthand + ", "
4949
}
50-
fmt.Fprintf(w, " %4v--%-20v%v\n", shorthand, f.Name, toSentenceCase(f.Usage))
50+
fmt.Fprintf(w, " %4v--%-20v%v\n", shorthand, f.Name, toSentenceCase(f.Usage)) //nolint:errcheck
5151
}
5252
}
5353
}

mangadex/api/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ func (c *Client) doJSON(ctx context.Context, method, ref string, result, body in
115115
if err != nil {
116116
return fmt.Errorf("do: %w", err)
117117
}
118-
defer resp.Body.Close()
118+
defer resp.Body.Close() //nolint:errcheck
119119

120120
dec := json.NewDecoder(resp.Body)
121121
if resp.StatusCode < 200 || resp.StatusCode >= 300 {

0 commit comments

Comments
 (0)