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

brokercap/Bifrost: plugin/clickhouse/src/normal_sync.go; 28 LoC

Open
#14,043 0 comments 0 reactions 0 assignees View on GitHub
fresh small
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [brokercap/Bifrost](https://www.github.com/brokercap/Bifrost) at [plugin/clickhouse/src/normal_sync.go](https://github.com/brokercap/Bifrost/blob/92a5f48c1129eedab279306407f29baa527d048b/plugin/clickhouse/src/normal_sync.go#L169-L196)

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 data is reassigned at line 179

[Click here to see the code in its original context.](https://github.com/brokercap/Bifrost/blob/92a5f48c1129eedab279306407f29baa527d048b/plugin/clickhouse/src/normal_sync.go#L169-L196)

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

```go
LOOP: for _, data := range insertDataMap {
val := make([]dbDriver.Value, 0)
for _, v := range This.p.Field {
var toV interface{}
toV, This.err = CkDataTypeTransfer(This.getMySQLData(&data,0,v.MySQL), v.CK, v.CkType,This.p.NullNotTransferDefault)
if This.err != nil {
if This.CheckDataSkip(&data) {
This.err = nil
continue LOOP
}
errData = &data
stmt.Close()
goto errLoop
}
val = append(val, toV)
}
_, This.err = stmt.Exec(val)
if This.err != nil {
if This.CheckDataSkip(&data) {
This.err = nil
continue LOOP
}
errData = &data
log.Println("plugin clickhouse insert exec err:",This.err," data:",val)
stmt.Close()
goto errLoop
}
}

```

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: 92a5f48c1129eedab279306407f29baa527d048b

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.