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

milosgajdos/vaultops: command/unseal.go; 13 LoC

Open
#17,735 0 comments 1 reaction 0 assignees View on GitHub
community: :+1: small
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [milosgajdos/vaultops](https://www.github.com/milosgajdos/vaultops) at [command/unseal.go](https://github.com/milosgajdos/vaultops/blob/877ff3d34ab15c977999b88bcf22c7dcae5a6b26/command/unseal.go#L106-L118)

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 host used in defer or goroutine at line 116

[Click here to see the code in its original context.](https://github.com/milosgajdos/vaultops/blob/877ff3d34ab15c977999b88bcf22c7dcae5a6b26/command/unseal.go#L106-L118)

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

```go
for _, host := range hosts {
v, err := c.Client(host, "")
if err != nil {
c.UI.Error(fmt.Sprintf("Failed to fetch Vault client: %v", err))
return 1
}
go func(h string) {
// check status and send down the status channel
c.UI.Info(fmt.Sprintf("Reading seal status of host: %s", h))
resp, err := v.Sys().SealStatus()
statChan <- &res{host: h, resp: resp, err: err}
}(host)
}

```

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: 877ff3d34ab15c977999b88bcf22c7dcae5a6b26

Contributor guide

No contributing guide indexed for this repository

Research direction

Read command/unseal.go at lines 106-118 and inspect the linked commit. Start by examining the analyzer warning and the goroutine's reported status behavior, then determine whether this is a bug, mitigated, or desirable behavior. Done means adding the appropriate classification reaction to the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.