Skip to content

Commit

Permalink
Fix two linter warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
svanharmelen committed Jun 21, 2023
1 parent d4057c7 commit 57a8f8f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions examples/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"strings"
Expand Down Expand Up @@ -70,7 +69,7 @@ func (hook webhook) handle(event interface{}) error {
// returns the parsed event or an error.
func (hook webhook) parse(r *http.Request) (interface{}, error) {
defer func() {
if _, err := io.Copy(ioutil.Discard, r.Body); err != nil {
if _, err := io.Copy(io.Discard, r.Body); err != nil {
log.Printf("could discard request body: %v", err)
}
if err := r.Body.Close(); err != nil {
Expand Down Expand Up @@ -100,7 +99,7 @@ func (hook webhook) parse(r *http.Request) (interface{}, error) {
return nil, errors.New("event not defined to be parsed")
}

payload, err := ioutil.ReadAll(r.Body)
payload, err := io.ReadAll(r.Body)
if err != nil || len(payload) == 0 {
return nil, errors.New("error reading request body")
}
Expand Down
2 changes: 1 addition & 1 deletion gitlab.go
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ func (c *Client) Do(req *retryablehttp.Request, v interface{}) (*Response, error
}
}

return response, nil
return response, err
}

func (c *Client) requestOAuthToken(ctx context.Context, token string) (string, error) {
Expand Down

0 comments on commit 57a8f8f

Please sign in to comment.