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

alantang888/ec2_degraded_instances_restarter: ec2_degraded_instances_restarter.go; 3 LoC

Open
#15,377 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 [alantang888/ec2_degraded_instances_restarter](https://www.github.com/alantang888/ec2_degraded_instances_restarter) at [ec2_degraded_instances_restarter.go](https://github.com/alantang888/ec2_degraded_instances_restarter/blob/b07e79d6b26564b7659174052efe507023820b34/ec2_degraded_instances_restarter.go#L248-L250)

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.

> function call which takes a reference to instanceId at line 249 may start a goroutine

[Click here to see the code in its original context.](https://github.com/alantang888/ec2_degraded_instances_restarter/blob/b07e79d6b26564b7659174052efe507023820b34/ec2_degraded_instances_restarter.go#L248-L250)

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

```go
for _, instanceId := range *previousSessionUnfinishedTasks {
go handleDegradedInstance(&instanceId, ec2Service, true)
}

```

Click here to show extra information the analyzer produced.

```
The following graphviz dot graph describes paths through the callgraph that could lead to a function calling a goroutine:
digraph G {
"(handleDegradedInstance, 3)" -> {"(waitForInstanceStop, 3)";}
"(waitForInstanceStop, 3)" -> {}
}

```

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Open ec2_degraded_instances_restarter.go at lines 248-250 and inspect the range loop together with handleDegradedInstance. Trace whether the referenced instanceId can be used after the goroutine starts, then classify the analyzer finding as Bug, Mitigated, or Desirable Behavior using the linked classification guidance.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.