github-vet / github-vet/rangeloop-pointer-findings
UKHO/AzurePipelinesAgentExporter: azdoCollector.go; 13 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [UKHO/AzurePipelinesAgentExporter](https://www.github.com/UKHO/AzurePipelinesAgentExporter) at [azdoCollector.go](https://github.com/UKHO/AzurePipelinesAgentExporter/blob/04ceaac7245e00184eaf6309936abac2003f5145/azdoCollector.go#L72-L84)
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 pool used in defer or goroutine at line 81
[Click here to see the code in its original context.](https://github.com/UKHO/AzurePipelinesAgentExporter/blob/04ceaac7245e00184eaf6309936abac2003f5145/azdoCollector.go#L72-L84)
Click here to show the 13 line(s) of Go which triggered the analyzer.
```go
for _, pool := range pools {
wg.Add(1)
go func(p azdo.Pool) {
agents, err := azc.AzDoClient.Agents(p.ID) //Get all Agents for pool
if err != nil {
errOccurred = true
log.WithFields(log.Fields{"serverName": azc.AzDoClient.Name, "poolId": p.ID, "err": err}).Error("Failed to retrieve agents for pool")
}
log.WithFields(log.Fields{"serverName": azc.AzDoClient.Name, "poolId": p.ID, "agentsInPoolCount": len(agents)}).Debug("Retrieved agents for pool")
metricsContextChanOut <- metricsContext{pool: p, agents: agents}
wg.Done()
}(pool)
}
```
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: 04ceaac7245e00184eaf6309936abac2003f5145
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.