github-vet / github-vet/rangeloop-pointer-findings
tdh8316/Investigo: investigo.go; 18 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [tdh8316/Investigo](https://www.github.com/tdh8316/Investigo) at [investigo.go](https://github.com/tdh8316/Investigo/blob/db08698e22e2a2d810b30f455edab13865dceff1/investigo.go#L246-L263)
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 username used in defer or goroutine at line 257
[Click here to see the code in its original context.](https://github.com/tdh8316/Investigo/blob/db08698e22e2a2d810b30f455edab13865dceff1/investigo.go#L246-L263)
Click here to show the 18 line(s) of Go which triggered the analyzer.
```go
for _, username := range usernames {
if options.noColor {
fmt.Printf("\nInvestigating %s on:\n", username)
} else {
fmt.Fprintf(color.Output, "Investigating %s on:\n", color.HiGreenString(username))
}
waitGroup.Add(len(siteData))
for site := range siteData {
guard <- 1
go func(site string) {
defer waitGroup.Done()
res := Investigo(username, site, siteData[site])
WriteResult(res)
<-guard
}(site)
}
waitGroup.Wait()
}
```
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: db08698e22e2a2d810b30f455edab13865dceff1
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with investigo.go lines 246-263 and inspect how the range-loop variable username is used inside the goroutine. Compare the analyzer's report with the surrounding code, then classify the finding as Bug, Mitigated, or Desirable Behavior based on the project's guidance.
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
- Mostly clear
- Newbie friendliness
- 35/100