github-vet / github-vet/rangeloop-pointer-findings
salviati/symutils: xlocate/xlocate.go; 19 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [salviati/symutils](https://www.github.com/salviati/symutils) at [xlocate/xlocate.go](https://github.com/salviati/symutils/blob/795b11cc8e533151753cf60f84ed2fd33d18947b/xlocate/xlocate.go#L195-L213)
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 method used in defer or goroutine at line 198
[Click here to see the code in its original context.](https://github.com/salviati/symutils/blob/795b11cc8e533151753cf60f84ed2fd33d18947b/xlocate/xlocate.go#L195-L213)
Click here to show the 19 line(s) of Go which triggered the analyzer.
```go
for _, method := range strings.Split(*searchMethod, ",") {
var err error
ch := make(chan string)
go func() { err = locate.Locate(db, method, pattern, ch) }()
for p := range ch {
nmatches++
m := &Match{Path: p, Base: filepath.Base(p), N: nmatches}
tpl.Execute(w, m)
}
if err != nil {
fmt.Println(w, err)
return
}
if nmatches > 0 {
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: 795b11cc8e533151753cf60f84ed2fd33d18947b
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.