github-vet / github-vet/rangeloop-pointer-findings
zry98/go-yubikey-val: internal/asynchttp/asynchttp.go; 5 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [zry98/go-yubikey-val](https://www.github.com/zry98/go-yubikey-val) at [internal/asynchttp/asynchttp.go](https://github.com/zry98/go-yubikey-val/blob/3aae4423149ac1fa2678a324c176c205c62a3349/internal/asynchttp/asynchttp.go#L43-L47)
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 url used in defer or goroutine at line 45
[Click here to see the code in its original context.](https://github.com/zry98/go-yubikey-val/blob/3aae4423149ac1fa2678a324c176c205c62a3349/internal/asynchttp/asynchttp.go#L43-L47)
Click here to show the 5 line(s) of Go which triggered the analyzer.
```go
for _, url := range urls {
go func() {
ch <- httpGet(ctx, url)
}()
}
```
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: 3aae4423149ac1fa2678a324c176c205c62a3349
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in internal/asynchttp/asynchttp.go at the loop around lines 43-47 and inspect how the goroutine uses the range variable url. Confirm the analyzer warning against the referenced commit and run the repository's relevant tests; done means the asynchronous requests use the intended URL for each iteration without the reported capture 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
- Mostly clear
- Newbie friendliness
- 35/100