github-vet / github-vet/rangeloop-pointer-findings
jmartin82/mmock: internal/server/router.go; 15 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [jmartin82/mmock](https://www.github.com/jmartin82/mmock) at [internal/server/router.go](https://github.com/jmartin82/mmock/blob/8e50ca9e4f58ba0f6d2df67bb6a06c38f09b4fe2/internal/server/router.go#L55-L69)
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.
> function call at line 60 may store a reference to m
[Click here to see the code in its original context.](https://github.com/jmartin82/mmock/blob/8e50ca9e4f58ba0f6d2df67bb6a06c38f09b4fe2/internal/server/router.go#L55-L69)
Click here to show the 15 line(s) of Go which triggered the analyzer.
```go
for _, m := range mocks {
r, err := rr.Checker.Match(req, &m, true)
if r {
//we return a copy of it, not the config itself because we will working on it.
md := mock.Definition{}
rr.copy(&m, &md)
mLog.Found = true
mLog.URI = m.URI
return &md, mLog
}
mLog.Errors = append(mLog.Errors, match.Error{URI: m.URI, Reason: err.Error()})
if err != match.ErrPathNotMatch {
log.Printf("Discarding mock: %s Reason: %s\n", m.URI, err.Error())
}
}
```
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: 8e50ca9e4f58ba0f6d2df67bb6a06c38f09b4fe2
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.