github-vet / github-vet/rangeloop-pointer-findings
sinmetal/sinmetalcraft: appengine/sinmetalcraft/src/sinmetalcraft/minecraftCron.go; 26 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [sinmetal/sinmetalcraft](https://www.github.com/sinmetal/sinmetalcraft) at [appengine/sinmetalcraft/src/sinmetalcraft/minecraftCron.go](https://github.com/sinmetal/sinmetalcraft/blob/c3877345f937d58d444517f2d445f5f5e9d4d7dc/appengine/sinmetalcraft/src/sinmetalcraft/minecraftCron.go#L60-L85)
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 ins used in defer or goroutine at line 68
[Click here to see the code in its original context.](https://github.com/sinmetal/sinmetalcraft/blob/c3877345f937d58d444517f2d445f5f5e9d4d7dc/appengine/sinmetalcraft/src/sinmetalcraft/minecraftCron.go#L60-L85)
Click here to show the 26 line(s) of Go which triggered the analyzer.
```go
for _, ins := range instances {
log.Infof(ctx, "Instance Name = %s, Status = %s", ins.Name, ins.Status)
if strings.HasPrefix(ins.Name, "minecraft-") {
log.Infof(ctx, `%s has prefix "minecraft-"`, ins.Name)
if ins.Status == "TERMINATED" {
taskCount++
go func() {
err = api.createSnapshot(ctx, ds, ins.Name[len("minecraft-"):len(ins.Name)])
receiver <- err
}()
}
} else if strings.HasPrefix(ins.Name, OverviewerInstanceName) {
log.Infof(ctx, `%s has prefix %s`, ins.Name, OverviewerInstanceName)
if ins.Status == "TERMINATED" {
oapi := OverviewerAPI{}
taskCount++
go func() {
err = oapi.deleteInstance(ctx, is, ins.Name)
receiver <- err
}()
}
} else {
log.Infof(ctx, `%s has not prefix.`, ins.Name)
}
}
```
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: c3877345f937d58d444517f2d445f5f5e9d4d7dc
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.