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

amazon-archives/aws-nlb-controller: pkg/controller/nlb/nlb_controller.go; 10 LoC

Open
#15,223 0 comments 0 reactions 0 assignees View on GitHub
fresh tiny
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [amazon-archives/aws-nlb-controller](https://www.github.com/amazon-archives/aws-nlb-controller) at [pkg/controller/nlb/nlb_controller.go](https://github.com/amazon-archives/aws-nlb-controller/blob/de81f5f1e84a0755f1eca1142b43de789ba9b9fb/pkg/controller/nlb/nlb_controller.go#L363-L372)

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 asgName was used in a composite literal at line 365

[Click here to see the code in its original context.](https://github.com/amazon-archives/aws-nlb-controller/blob/de81f5f1e84a0755f1eca1142b43de789ba9b9fb/pkg/controller/nlb/nlb_controller.go#L363-L372)

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

```go
for _, asgName := range asgNames {
_, err = asgClient.AttachLoadBalancerTargetGroups(&autoscaling.AttachLoadBalancerTargetGroupsInput{
AutoScalingGroupName: &asgName,
TargetGroupARNs: []*string{targetGroupARN},
})
if err != nil {
log.Error(err, "error attaching asg to TG", "asgName", asgName, "targetGroupARN", targetGroupARN)
return err
}
}

```

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: de81f5f1e84a0755f1eca1142b43de789ba9b9fb

Contributor guide

No contributing guide indexed for this repository

Research direction

Inspect pkg/controller/nlb/nlb_controller.go around lines 363-372, starting with the range over asgNames and the AttachLoadBalancerTargetGroupsInput construction. Determine whether referencing asgName there is a bug, mitigated, or desirable behavior, then classify the finding accordingly; no test is named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, go
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.