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

AdRoll/batchiepatchie: jobs/killer_handler.go; 14 LoC

Open
#13,354 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 [AdRoll/batchiepatchie](https://www.github.com/AdRoll/batchiepatchie) at [jobs/killer_handler.go](https://github.com/AdRoll/batchiepatchie/blob/e86e28f43218f578d6b838b50a888b8f97ddd552/jobs/killer_handler.go#L54-L67)

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 instance_id is reassigned at line 56

[Click here to see the code in its original context.](https://github.com/AdRoll/batchiepatchie/blob/e86e28f43218f578d6b838b50a888b8f97ddd552/jobs/killer_handler.go#L54-L67)

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

```go
for _, instance_id := range instances {
instances_ptr := make([]*string, 1)
instances_ptr[0] = &instance_id
terminate_instances := &ec2.TerminateInstancesInput{
InstanceIds: instances_ptr,
}
_, err := awsclients.EC2.TerminateInstances(terminate_instances)
if err != nil {
log.Warning("Cannot terminate instance ", instance_id, ": ", err)
// Don't return early but record the error
final_ret = err
}
log.Info("Terminated instance ", instance_id, " because it has a job at STARTING state stuck.")
}

```

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Read jobs/killer_handler.go at the linked commit and inspect the analyzer's reported reassignment in the shown 14-line snippet. Use the linked classification guidance and repository context to decide whether the finding is a Bug, Mitigated, or Desirable Behavior, then leave the corresponding reaction.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.