Skip to content
This repository has been archived by the owner on Nov 13, 2023. It is now read-only.

Commit

Permalink
chore: fix linters
Browse files Browse the repository at this point in the history
  • Loading branch information
ernado committed May 13, 2023
1 parent 49cb24b commit 7404771
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ linters-settings:
line-length: 140
goimports:
local-prefixes: github.com/go-faster/gh-archive-yt
revive:
rules:
- name: exported
disabled: true
gocritic:
enabled-tags:
- diagnostic
Expand Down
16 changes: 7 additions & 9 deletions internal/gh/gh.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type Client struct {
tokens []string
}

func NewClient(http HTTPClient, tok string) *Client {
func NewClient(client HTTPClient, tok string) *Client {
var tokens []string
for _, v := range strings.Split(tok, ",") {
v = strings.TrimSpace(v)
Expand All @@ -33,10 +33,11 @@ func NewClient(http HTTPClient, tok string) *Client {
}
tokens = append(tokens, v)
}
rnd := rand.New(rand.NewSource(time.Now().Unix())) // #nosec G404
return &Client{
http: http,
http: client,
tokens: tokens,
rand: rand.New(rand.NewSource(time.Now().Unix())),
rand: rnd,
}
}

Expand Down Expand Up @@ -90,7 +91,7 @@ type Event struct {
}

func (e *Event) Parse() error {
if err := jx.DecodeBytes(e.Raw).ObjBytes(func(d *jx.Decoder, k []byte) error {
return jx.DecodeBytes(e.Raw).ObjBytes(func(d *jx.Decoder, k []byte) error {
switch string(k) {
case "created_at":
v, err := d.Str()
Expand Down Expand Up @@ -118,14 +119,11 @@ func (e *Event) Parse() error {
}
return nil
}
}); err != nil {
return err
}
return nil
})
}

func (c *Client) Events(ctx context.Context, p Params) (*Result[[]Event], error) {
req, err := http.NewRequestWithContext(ctx, http.MethodGet, "https://api.github.com/events", nil)
req, err := http.NewRequestWithContext(ctx, http.MethodGet, "https://api.github.com/events", http.NoBody)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 7404771

Please sign in to comment.