github-vet / github-vet/rangeloop-pointer-findings
AutoSpotting/AutoSpotting: core/instance.go; 15 LoC
- 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
Research direction
Inspect core/instance.go at lines 242-256, starting with the reassignment of asg and the assignment of &asg to i.asg. Determine whether this behavior is a bug, mitigated, or desirable, then leave the corresponding reaction on the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100