github-vet / github-vet/rangeloop-pointer-findings

2kranki/genapp: pkg/genSqlAppGo/dbJson/dbJson.go; 7 LoC

Open
#15,306 0 comments 0 reactions 0 assignees View on GitHub
fresh tiny
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [2kranki/genapp](https://www.github.com/2kranki/genapp) at [pkg/genSqlAppGo/dbJson/dbJson.go](https://github.com/2kranki/genapp/blob/6d592b33436c7a0c636d619243a1f34819e87a01/pkg/genSqlAppGo/dbJson/dbJson.go#L752-L758)

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.

> reference to t is reassigned at line 754

[Click here to see the code in its original context.](https://github.com/2kranki/genapp/blob/6d592b33436c7a0c636d619243a1f34819e87a01/pkg/genSqlAppGo/dbJson/dbJson.go#L752-L758)

Click here to show the 7 line(s) of Go which triggered the analyzer.

```go
for i, t := range d.Tables {
for ii, _ := range t.Fields {
t.Fields[ii].Tbl = &t
}
// Link each table back to the database.
d.Tables[i].DB = DbStruct()
}

```

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: 6d592b33436c7a0c636d619243a1f34819e87a01

Contributor guide

No contributing guide indexed for this repository

Research direction

Read pkg/genSqlAppGo/dbJson/dbJson.go around lines 752-758 and inspect the surrounding generated code. Verify whether the references assigned through the range variable t point to the intended table values, then check for any additional analyzer finding in this snippet. Done means determining and reporting whether the finding is a Bug, Mitigated, or Desirable Behavior.

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
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.