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

trek10inc/awsets: lister/codedeploy_deploymentconfig.go; 14 LoC

Open
#13,210 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 [trek10inc/awsets](https://www.github.com/trek10inc/awsets) at [lister/codedeploy_deploymentconfig.go](https://github.com/trek10inc/awsets/blob/92e0054d69b0d5bd0c17536cb00404848a45f0b6/lister/codedeploy_deploymentconfig.go#L36-L49)

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.

> reference to config was used in a composite literal at line 38

[Click here to see the code in its original context.](https://github.com/trek10inc/awsets/blob/92e0054d69b0d5bd0c17536cb00404848a45f0b6/lister/codedeploy_deploymentconfig.go#L36-L49)

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

```go
for _, config := range res.DeploymentConfigsList {
configRes, err := svc.GetDeploymentConfig(ctx.Context, &codedeploy.GetDeploymentConfigInput{
DeploymentConfigName: &config,
})
if err != nil {
return nil, fmt.Errorf("failed to get codedeploy deployment config %s: %w", config, err)
}
v := configRes.DeploymentConfigInfo
if v == nil {
continue
}
r := resource.New(ctx, resource.CodeDeployDeploymentConfig, v.DeploymentConfigId, v.DeploymentConfigName, v)
rg.AddResource(r)
}

```

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: 92e0054d69b0d5bd0c17536cb00404848a45f0b6

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in lister/codedeploy_deploymentconfig.go at the loop around lines 36-49 and inspect how config is referenced in the GetDeploymentConfigInput composite literal. Confirm the analyzer finding against the Go range-loop behavior and check the surrounding lister logic. Done means the finding is addressed without changing the resources returned for each deployment configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, go
Domain
cloud
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.