Skip to content

Commit

Permalink
refactor: use struct instantiation value
Browse files Browse the repository at this point in the history
  • Loading branch information
lavafroth committed Jul 14, 2023
1 parent 7097804 commit 6ad0592
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
4 changes: 2 additions & 2 deletions pkg/providers/otx/otx.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (c *Client) Name() string {

func (c *Client) Fetch(ctx context.Context, domain string, results chan string) error {
paginate:
for page := 1; ; page++ {
for page := uint(1); ; page++ {
select {
case <-ctx.Done():
break paginate
Expand Down Expand Up @@ -75,7 +75,7 @@ paginate:
return nil
}

func (c *Client) formatURL(domain string, page int) string {
func (c *Client) formatURL(domain string, page uint) string {
category := "hostname"
if !domainutil.HasSubdomain(domain) {
category = "domain"
Expand Down
2 changes: 1 addition & 1 deletion pkg/providers/urlscan/urlscan.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (c *Client) Fetch(ctx context.Context, domain string, results chan string)
}

paginate:
for page := 0; ; page++ {
for page := uint(0); ; page++ {
select {
case <-ctx.Done():
break paginate
Expand Down
15 changes: 5 additions & 10 deletions pkg/providers/wayback/wayback.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,8 @@ type Client struct {
config *providers.Config
}

func New(c *providers.Config, filters providers.Filters) *Client {
return &Client{
filters: filters,
config: c,
}
func New(config *providers.Config, filters providers.Filters) *Client {
return &Client{filters, config}
}

func (c *Client) Name() string {
Expand Down Expand Up @@ -69,11 +66,9 @@ func (c *Client) Fetch(ctx context.Context, domain string, results chan string)
}

// output results
for i, entry := range result {
// Skip first result by default
if i != 0 {
results <- entry[0]
}
// Slicing as [1:] to skip first result by default
for _, entry := range result[1:] {
results <- entry[0]
}
}
}
Expand Down

0 comments on commit 6ad0592

Please sign in to comment.