github-vet / github-vet/rangeloop-pointer-findings
MrLTJ19941003/awesomeProject: lang/fastSearchFilename/main.go; 22 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [MrLTJ19941003/awesomeProject](https://www.github.com/MrLTJ19941003/awesomeProject) at [lang/fastSearchFilename/main.go](https://github.com/MrLTJ19941003/awesomeProject/blob/e99221f5625b535f6b918b8173c8ab72a6fe575e/lang/fastSearchFilename/main.go#L27-L48)
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 31
[Click here to see the code in its original context.](https://github.com/MrLTJ19941003/awesomeProject/blob/e99221f5625b535f6b918b8173c8ab72a6fe575e/lang/fastSearchFilename/main.go#L27-L48)
Click here to show the 22 line(s) of Go which triggered the analyzer.
```go
for _, v := range dir_list {
if strings.Contains(v.Name(),filenameTest){
fmt.Println("已找到",v.Name(),"文件,目录为:", pathName,)
go func() {
w.done <- v.Name()
//close(w.done)
}()
// break
}
if v.IsDir(){
str := pathName+v.Name()+"/"
w.in <- str
//w.done <- true
}
//go func(name ,pathn string,isDir bool) {
// if isDir{
// str := pathn+name+"/"
// w.in <- str
// w.done <- true
// }
//}(v.Name(),pathName,v.IsDir(),)
}
```
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: e99221f5625b535f6b918b8173c8ab72a6fe575e
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.