github-vet / github-vet/rangeloop-pointer-findings
ReyzaldyIndra/TicketBooking: v1/book.go; 13 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [ReyzaldyIndra/TicketBooking](https://www.github.com/ReyzaldyIndra/TicketBooking) at [v1/book.go](https://github.com/ReyzaldyIndra/TicketBooking/blob/b86d40f46040f2fae60dd6ae931d762bfe5bc883/v1/book.go#L80-L92)
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/ReyzaldyIndra/TicketBooking/blob/b86d40f46040f2fae60dd6ae931d762bfe5bc883/v1/book.go#L80-L92)
Click here to show the 13 line(s) of Go which triggered the analyzer.
```go
for i, item := range bookings {
var items Product
db.DB.Select(&item, "SELECT * FROM products WHERE id = ?", item.Id_Item)
var customer Customer
db.DB.Select(&customer, "SELECT * FROM customers WHERE id = ?", item.Id_Customer)
response[i] = &Book{
Item: items,
Quantity: item.Quantity,
Total: item.Total,
Status: item.Status,
Customer: customer,
}
}
```
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 {Select 3} 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: b86d40f46040f2fae60dd6ae931d762bfe5bc883
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with v1/book.go lines 80-92 at the linked commit and inspect the range over bookings and its two db.DB.Select calls. Compare the shown code with the analyzer output and decide whether the finding is a Bug, Mitigated, or Desirable Behavior; done means leaving the corresponding reaction on this issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100