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

upfluence/sensu-coreos: clients/sensu-aws-client/check.go; 30 LoC

Open
#17,047 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 [upfluence/sensu-coreos](https://www.github.com/upfluence/sensu-coreos) at [clients/sensu-aws-client/check.go](https://github.com/upfluence/sensu-coreos/blob/5bdcc4584de9e41e4e46f296f96dc3650baf9288/clients/sensu-aws-client/check.go#L110-L139)

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 instance used in defer or goroutine at line 130

[Click here to see the code in its original context.](https://github.com/upfluence/sensu-coreos/blob/5bdcc4584de9e41e4e46f296f96dc3650baf9288/clients/sensu-aws-client/check.go#L110-L139)

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

```go
for _, instance := range reservation.Instances {
name := ""

for _, tag := range instance.Tags {
if *tag.Key == "Name" {
name = *tag.Value
}
}

if !strings.HasPrefix(name, "core-") {
continue
}

log.Println(name)

wg.Add(1)

go func() {
defer wg.Done()

if !test(*instance.PrivateIpAddress) {
log.Printf("%s: failed", name)

mu.Lock()
defer mu.Unlock()

failedInstances = append(failedInstances, *instance.InstanceId)
}
}()
}

```

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: 5bdcc4584de9e41e4e46f296f96dc3650baf9288

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.