github-vet / github-vet/rangeloop-pointer-findings
dutchcoders/lootbox: app/app.go; 37 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [dutchcoders/lootbox](https://www.github.com/dutchcoders/lootbox) at [app/app.go](https://github.com/dutchcoders/lootbox/blob/5c69201c12cb83c7121c59346528e8e732f63b81/app/app.go#L134-L170)
Below is the message reported by the analyzer for this snippet of code. Beware that the analyzer only reports the first issue it finds, so please do not limit your consideration to the contents of the below message.
> range-loop variable keyword used in defer or goroutine at line 140
[Click here to see the code in its original context.](https://github.com/dutchcoders/lootbox/blob/5c69201c12cb83c7121c59346528e8e732f63b81/app/app.go#L134-L170)
Click here to show the 37 line(s) of Go which triggered the analyzer.
```go
for _, keyword := range a.keywords {
wg.Add(1)
go func() {
defer wg.Done()
feed := tc.Feed(context.Background(), keyword)
for tweet := range feed {
// fmt.Println(color.YellowString(tweet))
links := re.FindAllString(tweet, -1)
for _, link := range links {
re := regexp.MustCompile(`[\[\]]`)
link = re.ReplaceAllString(link, "")
u, err := url.Parse(link)
if err != nil {
fmt.Println(color.RedString(link, err.Error()))
continue
}
if u.Scheme == "" {
continue
}
if u.Scheme == "hxxp" {
u.Scheme = "http"
} else if u.Scheme == "hxxps" {
u.Scheme = "https"
}
d.Download(u)
}
}
}()
}
```
Leave a reaction on this issue to contribute to the project by classifying this instance as a **Bug** :-1:, **Mitigated** :+1:, or **Desirable Behavior** :rocket:
See the descriptions of the classifications [here](https://github.com/github-vet/rangeclosure-findings#how-can-i-help) for more information.
commit ID: 5c69201c12cb83c7121c59346528e8e732f63b81
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with app/app.go lines 134-170 and inspect the goroutine launched inside the range over a.keywords, especially how keyword is used by tc.Feed. Determine whether the analyzer warning represents a bug, mitigated behavior, or desirable behavior, then leave the corresponding reaction on this issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100