github-vet / github-vet/rangeloop-pointer-findings
tamnd/httpclient: client.go; 23 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [tamnd/httpclient](https://www.github.com/tamnd/httpclient) at [client.go](https://github.com/tamnd/httpclient/blob/b92a0ecc8653d505e7573b3ca347c3344b69bc69/client.go#L136-L158)
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 139
[Click here to see the code in its original context.](https://github.com/tamnd/httpclient/blob/b92a0ecc8653d505e7573b3ca347c3344b69bc69/client.go#L136-L158)
Click here to show the 23 line(s) of Go which triggered the analyzer.
```go
for i, url := range urls {
go func(i int) {
defer wg.Done()
resp, err := c.Get(url)
if err != nil {
ch <- err
return
}
defer resp.Body.Close()
if resp.StatusCode != 200 {
var err error
err = c.err(resp, "")
ch <- err
return
}
fs[i].Data, err = ioutil.ReadAll(resp.Body)
if err != nil {
ch <- c.err(resp, err.Error())
return
}
ch <- nil
}(i)
}
```
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: b92a0ecc8653d505e7573b3ca347c3344b69bc69
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.