github-vet / github-vet/rangeloop-pointer-findings
jdub/aws-iam-authorizedkeys: main.go; 26 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [jdub/aws-iam-authorizedkeys](https://www.github.com/jdub/aws-iam-authorizedkeys) at [main.go](https://github.com/jdub/aws-iam-authorizedkeys/blob/1db6c0dc74ec223ae685a269007e21bde5160508/main.go#L124-L149)
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 key used in defer or goroutine at line 133
[Click here to see the code in its original context.](https://github.com/jdub/aws-iam-authorizedkeys/blob/1db6c0dc74ec223ae685a269007e21bde5160508/main.go#L124-L149)
Click here to show the 26 line(s) of Go which triggered the analyzer.
```go
for _, key := range keys.SSHPublicKeys {
if *key.Status != "Active" {
continue
}
wg.Add(1)
go func() {
params := &iam.GetSSHPublicKeyInput{
Encoding: aws.String("SSH"),
SSHPublicKeyId: key.SSHPublicKeyId,
UserName: aws.String(userName),
}
key, err := svc.GetSSHPublicKey(params)
if DEBUG {
fmt.Fprintln(os.Stderr, key)
}
if err == nil {
fmt.Printf("%s # %s\n",
*key.SSHPublicKey.SSHPublicKeyBody, userName)
}
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: 1db6c0dc74ec223ae685a269007e21bde5160508
Contributor guide
No contributing guide indexed for this repository
Research direction
Open the referenced main.go section at lines 124-149 and inspect how the range variable is used inside the goroutine. Confirm whether the analyzer warning represents an actual behavior problem, then classify the finding with the requested Bug, Mitigated, or Desirable Behavior reaction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100