github-vet / github-vet/rangeloop-pointer-findings
brnv/heaverd-ng: cluster.go; 21 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [brnv/heaverd-ng](https://www.github.com/brnv/heaverd-ng) at [cluster.go](https://github.com/brnv/heaverd-ng/blob/afc7f5d5afe44697fc7bb2db26d36fa18dafc419/cluster.go#L55-L75)
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 c used in defer or goroutine at line 61
[Click here to see the code in its original context.](https://github.com/brnv/heaverd-ng/blob/afc7f5d5afe44697fc7bb2db26d36fa18dafc419/cluster.go#L55-L75)
Click here to show the 21 line(s) of Go which triggered the analyzer.
```go
for _, c := range containers {
// workaround for getting some kind of bulk-insert
// without goroutine this may take a while
go func() {
wg.Add(1)
container, _ := json.Marshal(c)
if update {
_, err = storage.Set("containers/"+c.Name, string(container), storedKeyTtl)
} else {
_, err = storage.Create("containers/"+c.Name, string(container), storedKeyTtl)
}
if err != nil {
log.Notice(err.Error())
}
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: afc7f5d5afe44697fc7bb2db26d36fa18dafc419
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.