github-vet / github-vet/rangeloop-pointer-findings
a7a2/option.bzza.com: controllers/calculate.go; 48 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [a7a2/option.bzza.com](https://www.github.com/a7a2/option.bzza.com) at [controllers/calculate.go](https://github.com/a7a2/option.bzza.com/blob/395869f84b17d11b8d818612b40e15c820956442/controllers/calculate.go#L179-L226)
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.
>
[Click here to see the code in its original context.](https://github.com/a7a2/option.bzza.com/blob/395869f84b17d11b8d818612b40e15c820956442/controllers/calculate.go#L179-L226)
Click here to show the 48 line(s) of Go which triggered the analyzer.
```go
for _, v := range *tArr {
ex := v.OpenDate + int64(v.Period)
switch {
case v.Close:
continue
case (v.Direction == 0 || v.Direction == 1 || v.Direction == 2 || v.Direction == 3) && ex < time.Now().Unix():
if calStepClearDirection0123(&v, ex) == false {
continue
}
case (v.Direction == 4 || v.Direction == 5 || v.Direction == 6 || v.Direction == 7):
if calStepClearDirection4567(&v, v.OpenDate, ex) == false {
continue
}
default:
continue
}
v.Close = true
if time.Now().Unix() > ex {
v.CloseDate = ex
} else {
v.CloseDate = time.Now().Unix()
}
u := &models.Users{
Uuid: v.UserUuid,
}
if err := u.FindUsersByUuid(v.UserUuid.String()); err != nil {
return
}
fmt.Println(v.Profit, " ", fmt.Sprintf("sumOptionDeals+%v", v.Profit))
redis.RedisClient.HDel("valuation_clear", v.Uuid.String()) //结算完删除redis上的单
//v.Update() //交易更新到库
u.SumOptionDeals += v.Profit
if v.Profit > 0.0 {
u.Balance = u.Balance + v.Profit + v.InvestmentSum
v.Balance = v.Balance + v.Profit + v.InvestmentSum
//u.UpdateBalance(v.Profit) //用户更新到库
//v.Profit -= v.InvestmentSum
}
models.Clear(&v, u)
unicast(u) //结算后推送到用户端
}
```
Click here to show extra information the analyzer produced.
```
No path was found through the callgraph that could lead to a function which writes a pointer argument.
No path was found through the callgraph that could lead to a function which passes a pointer to third-party code.
root signature {Clear 2} was not found in the callgraph; reference was passed directly to third-party code
```
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: 395869f84b17d11b8d818612b40e15c820956442
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.