github-vet / github-vet/rangeloop-pointer-findings
TinyUlt/huobi: src/main.go; 24 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [TinyUlt/huobi](https://www.github.com/TinyUlt/huobi) at [src/main.go](https://github.com/TinyUlt/huobi/blob/03e9a8987520601019502f917ee1a90d24c2b859/src/main.go#L88-L111)
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 email used in defer or goroutine at line 108
[Click here to see the code in its original context.](https://github.com/TinyUlt/huobi/blob/03e9a8987520601019502f917ee1a90d24c2b859/src/main.go#L88-L111)
Click here to show the 24 line(s) of Go which triggered the analyzer.
```go
for _,email := range emails{
mailfrom := getSendPerson()
m := gomail.NewMessage()
m.SetHeader("From", mailfrom)
m.SetHeader("To", email, email)
m.SetAddressHeader("Cc", email, "Dan")
m.SetHeader("Subject", subject)
m.SetBody("text/html", data)
//m.Attach("/home/Alex/lolcat.jpg")
d := gomail.NewDialer("smtp.exmail.qq.com", 465, mailfrom, mailtoPassword)
// Send the email to Bob, Cora and Dan.
go func(m *gomail.Message){
if err := d.DialAndSend(m); err != nil {
fmt.Println(err)
return
}
fmt.Println(fmt.Sprintf("%s %s to %s:%s",timeStr,mailfrom, email, subject) )
}(m)
}
```
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: 03e9a8987520601019502f917ee1a90d24c2b859
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.