github-vet / github-vet/rangeloop-pointer-findings
Collapsars/w3s.com.cn_go: src/w3s.com.cn/main/app_hander_data_01.go; 39 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [Collapsars/w3s.com.cn_go](https://www.github.com/Collapsars/w3s.com.cn_go) at [src/w3s.com.cn/main/app_hander_data_01.go](https://github.com/Collapsars/w3s.com.cn_go/blob/a0482b8a289a22343045ab6a6c64cef88e7b1ad0/src/w3s.com.cn/main/app_hander_data_01.go#L41-L79)
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 value used in defer or goroutine at line 45
[Click here to see the code in its original context.](https://github.com/Collapsars/w3s.com.cn_go/blob/a0482b8a289a22343045ab6a6c64cef88e7b1ad0/src/w3s.com.cn/main/app_hander_data_01.go#L41-L79)
Click here to show the 39 line(s) of Go which triggered the analyzer.
```go
for _,value := range articles {
ch <- 1
go func() {
doc , err := goquery.NewDocumentFromReader(strings.NewReader(value.Content))
utils.CheckErr(err)
//去掉
doc.Find("a").Each(func(i int , s *goquery.Selection) {
link,_ := s.Attr("href")
r, _ := regexp.Compile("^http://www.runoob.com/")
if r.MatchString(link){
//fmt.Println(link)
path := string(r.ReplaceAll([]byte(link),[]byte("/")))
s.SetAttr("href",path)
//fmt.Println(path)
}
})
//article := Article{};
//article.Id = value.Id
value.Content,err = doc.Html()
//Content,err := doc.Html()
//fmt.Println(article)
db.Save(&value)
fmt.Println(time.Now().UnixNano())
<- ch
}()
fmt.Println("end")
//fmt.Println(doc.Html())
}
```
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: a0482b8a289a22343045ab6a6c64cef88e7b1ad0
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.