Skip to content

Commit

Permalink
fix: enable bodyclose linter
Browse files Browse the repository at this point in the history
  • Loading branch information
nobe4 committed Jan 2, 2025
1 parent dc40a12 commit 20dfb5e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
5 changes: 2 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ linters:

disable:
# TODO: remove the line and fix the issues
- bodyclose
- cyclop
- depguard
- err113
- errorlint
- forbidigo
- gochecknoglobals
- gochecknoinits
- gomnd
- mnd
- inamedparam
- ireturn
- lll
Expand All @@ -34,13 +33,13 @@ linters:
- exhaustruct # it's ok not to specify all the fields in a struct definition

# deprecated
- mnd
- exportloopref

issues:
exclude-rules:
- path: _test.go
linters:
- bodyclose
- funlen

linters-settings:
Expand Down
3 changes: 2 additions & 1 deletion internal/actions/assign/assign.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,11 @@ func (a *Runner) Run(n *notifications.Notification, assignees []string, w io.Wri
return err
}

_, err = a.Client.API.Request(http.MethodPost, assigneesURL, bytes.NewReader(body))
r, err := a.Client.API.Request(http.MethodPost, assigneesURL, bytes.NewReader(body))
if err != nil {
return err
}
defer r.Body.Close()

fmt.Fprint(w, colors.Red("ASSIGN ")+n.String()+" to "+strings.Join(assignees, ", "))

Expand Down
3 changes: 2 additions & 1 deletion internal/actions/done/done.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ func (a *Runner) Run(n *notifications.Notification, _ []string, w io.Writer) err

n.Meta.Done = true

_, err := a.Client.API.Request(http.MethodDelete, n.URL, nil)
r, err := a.Client.API.Request(http.MethodDelete, n.URL, nil)
if err != nil {
return err
}
defer r.Body.Close()

fmt.Fprint(w, colors.Red("DONE ")+n.String())

Expand Down
3 changes: 2 additions & 1 deletion internal/actions/read/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ type Runner struct {
}

func (a *Runner) Run(n *notifications.Notification, _ []string, w io.Writer) error {
_, err := a.Client.API.Request(http.MethodPatch, n.URL, nil)
r, err := a.Client.API.Request(http.MethodPatch, n.URL, nil)

// go-gh currently fails to handle HTTP-205 correctly, however it's possible
// to catch this case.
// ref: https://github.com/cli/go-gh/issues/161
if err != nil && err.Error() != "unexpected end of JSON input" {
return err
}
defer r.Body.Close()

n.Unread = false

Expand Down

0 comments on commit 20dfb5e

Please sign in to comment.