github-vet / github-vet/rangeloop-pointer-findings
ichn-hu/IDBS-Spring20-Fudan: assignments/ass2/submission/18307130116/utils.go; 20 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [ichn-hu/IDBS-Spring20-Fudan](https://www.github.com/ichn-hu/IDBS-Spring20-Fudan) at [assignments/ass2/submission/18307130116/utils.go](https://github.com/ichn-hu/IDBS-Spring20-Fudan/blob/e31d2e5a1184df634afef93758b06fe61add9123/assignments/ass2/submission/18307130116/utils.go#L55-L74)
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 sub2 used in defer or goroutine at line 60
[Click here to see the code in its original context.](https://github.com/ichn-hu/IDBS-Spring20-Fudan/blob/e31d2e5a1184df634afef93758b06fe61add9123/assignments/ass2/submission/18307130116/utils.go#L55-L74)
Click here to show the 20 line(s) of Go which triggered the analyzer.
```go
for comparer, sub2 := range subs {
wg.Add(1)
go func() {
for i:= 0; i < NumSQL; i++{
var equal int
if reflect.DeepEqual(sub.sqlResults[i], sub2.sqlResults[i]) {
equal = 1
} else {
equal = 0
}
s := fmt.Sprintf("INSERT INTO comparison_result VALUES ('%s', '%s', %d, %d)", submitter, comparer, i+1, equal)
_, err := db.Exec(s)
if err != nil {
fmt.Println(s)
panic(err)
}
}
wg.Done()
}()
}
```
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: e31d2e5a1184df634afef93758b06fe61add9123
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.