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

AutoSpotting/AutoSpotting: core/instance.go; 15 LoC

Open
#5,954 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 [AutoSpotting/AutoSpotting](https://www.github.com/AutoSpotting/AutoSpotting) at [core/instance.go](https://github.com/AutoSpotting/AutoSpotting/blob/3a1f77a890f5dfbc1757aa0661c16c035ef069ea/core/instance.go#L242-L256)

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 asg is reassigned at line 250

[Click here to see the code in its original context.](https://github.com/AutoSpotting/AutoSpotting/blob/3a1f77a890f5dfbc1757aa0661c16c035ef069ea/core/instance.go#L242-L256)

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

```go
for _, asg := range i.region.enabledASGs {
if asg.name == *asgName && asg.isEnabledForEventBasedInstanceReplacement() {
asg.config = i.region.conf.AutoScalingConfig
asg.scanInstances()
asg.loadDefaultConfig()
asg.loadConfigFromTags()
asg.loadLaunchConfiguration()
asg.loadLaunchTemplate()
i.asg = &asg
i.price = i.typeInfo.pricing.onDemand / i.region.conf.OnDemandPriceMultiplier * i.asg.config.OnDemandPriceMultiplier
logger.Printf("%s instace %s belongs to enabled ASG %s", i.region.name,
*i.InstanceId, i.asg.name)
return true
}
}

```

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: 3a1f77a890f5dfbc1757aa0661c16c035ef069ea

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.