github-vet / github-vet/rangeloop-pointer-findings
simple-devops/sp-proxy: client.go; 29 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [simple-devops/sp-proxy](https://www.github.com/simple-devops/sp-proxy) at [client.go](https://github.com/simple-devops/sp-proxy/blob/e72607d5ad2281bc3ec834f957bec24ef2f0598d/client.go#L70-L98)
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 v used in defer or goroutine at line 82
[Click here to see the code in its original context.](https://github.com/simple-devops/sp-proxy/blob/e72607d5ad2281bc3ec834f957bec24ef2f0598d/client.go#L70-L98)
Click here to show the 29 line(s) of Go which triggered the analyzer.
```go
for _, v := range C.Routers {
matched, _ := regexp.MatchString(v.Path, reqData.URL)
if matched {
if v.Strip > 0 && v.Strip < len(URL) {
URL = URL[v.Strip:]
}
host = v.Upstream
if v.CopyStream != "" {
go func() {
client := &http.Client{
Timeout: 60 * time.Second,
}
req, err := http.NewRequest(reqData.Method, v.CopyStream+URL, bytes.NewReader(reqData.Body))
if err != nil {
fmt.Println(err)
} else {
for k, v := range reqData.Header {
req.Header.Set(k, v)
}
_, errres := client.Do(req)
if errres != nil {
fmt.Println(errres)
}
}
}()
}
break
}
}
```
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: e72607d5ad2281bc3ec834f957bec24ef2f0598d
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.