github-vet / github-vet/rangeloop-pointer-findings
karthikpanicker/automatictactoe: etsy_synchronizer.go; 42 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [karthikpanicker/automatictactoe](https://www.github.com/karthikpanicker/automatictactoe) at [etsy_synchronizer.go](https://github.com/karthikpanicker/automatictactoe/blob/5f0882b457ed5191a76074fc8d8ce96516201ff2/etsy_synchronizer.go#L28-L69)
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.
> function call at line 58 may store a reference to userDetails
[Click here to see the code in its original context.](https://github.com/karthikpanicker/automatictactoe/blob/5f0882b457ed5191a76074fc8d8ce96516201ff2/etsy_synchronizer.go#L28-L69)
Click here to show the 42 line(s) of Go which triggered the analyzer.
```go
for _, userDetails := range userList {
//Need to fetch transactions for the user only if he has linked any of the apps
if userDetails.TrelloDetails.IsLinked == false &&
userDetails.GTasksDetails.IsLinked == false &&
userDetails.TodoistDetails.IsLinked == false {
continue
}
response, err := edm.GetAppData(&userDetails, apps.EtsyTransactionListRequest, nil)
if err != nil {
common.Error(err)
continue
}
//
orderList := response.(*common.EtsyTransactionResponse)
sort.Slice(orderList.Results[:], func(i, j int) bool {
return orderList.Results[i].PaidTime < orderList.Results[j].PaidTime
})
for i := 0; i < len(orderList.Results); i++ {
etsyTransaction := orderList.Results[i]
if etsyTransaction.ShippedTime == 0 {
reqParamsMap := make(map[string]interface{})
reqParamsMap[apps.EtsyReceiptIdKey] = strconv.Itoa(etsyTransaction.ReceiptID)
response, _ := edm.GetAppData(&userDetails, apps.EtsyReceiptDetailsRequest, reqParamsMap)
receiptDetails := response.(*common.EtsyReceiptDetails)
time.Sleep(time.Second * 1)
var lastTransactionIndex = 0
if i > 0 {
lastTransactionIndex = i - 1
}
if userDetails.TrelloDetails.IsLinked {
es.postTransactionToTrello(edm, etsyTransaction, &userDetails, receiptDetails, orderList.Results[lastTransactionIndex])
}
if userDetails.GTasksDetails.IsLinked {
es.postTransactionToGTasks(etsyTransaction, &userDetails, receiptDetails)
}
if userDetails.TodoistDetails.IsLinked {
es.postTransactionToTodoist(etsyTransaction, &userDetails, receiptDetails)
}
}
}
es.dCache.SaveDetailsToCache(userDetails.UserID, userDetails)
}
```
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: 5f0882b457ed5191a76074fc8d8ce96516201ff2
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.