github-vet / github-vet/rangeloop-pointer-findings
liamzdenek/go-jsonapi: tests/HttpTestFramework.go; 30 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [liamzdenek/go-jsonapi](https://www.github.com/liamzdenek/go-jsonapi) at [tests/HttpTestFramework.go](https://github.com/liamzdenek/go-jsonapi/blob/5001978bac551e7e0da6c7db67cfb48bac85845d/tests/HttpTestFramework.go#L49-L78)
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.
> reference to test was used in a composite literal at line 52
[Click here to see the code in its original context.](https://github.com/liamzdenek/go-jsonapi/blob/5001978bac551e7e0da6c7db67cfb48bac85845d/tests/HttpTestFramework.go#L49-L78)
Click here to show the 30 line(s) of Go which triggered the analyzer.
```go
for _, test := range ts.Tests {
session := &TestSession{
Server: server,
Test: &test,
Request: &http.Request{},
}
work := func() {
for _, cr := range test.Criteria {
cr.Setup(session)
}
cl := http.Client{}
res, err := cl.Do(session.Request)
Check(err)
session.Response = res
for _, cr := range test.Criteria {
cr.Check(session)
}
}
err := Catch(work)
if err != nil {
rawReq, terr := httputil.DumpRequestOut(session.Request, true)
Check(terr)
rawRes, terr := httputil.DumpResponse(session.Response, true)
Check(terr)
ts.T.Errorf("Error running test: %#v\n\nTEST DESCRIPTION:\n\n%s\nREQUEST:\n\n%s\nRESPONSE:\n\n%s\n", err, test.Describe(), string(rawReq), string(rawRes))
}
}
```
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: 5001978bac551e7e0da6c7db67cfb48bac85845d
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.