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

TeaOSLab/EdgeAPI: internal/nodes/api_node.go; 15 LoC

Open
#15,271 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 [TeaOSLab/EdgeAPI](https://www.github.com/TeaOSLab/EdgeAPI) at [internal/nodes/api_node.go](https://github.com/TeaOSLab/EdgeAPI/blob/f905bb7066d690511a4916b85253451181c6c85c/internal/nodes/api_node.go#L87-L101)

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.

> range-loop variable addr used in defer or goroutine at line 96

[Click here to see the code in its original context.](https://github.com/TeaOSLab/EdgeAPI/blob/f905bb7066d690511a4916b85253451181c6c85c/internal/nodes/api_node.go#L87-L101)

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

```go
for _, addr := range listen.Addresses() {
listener, err := net.Listen("tcp", addr)
if err != nil {
remotelogs.Error("API_NODE", "listening '"+addr+"' failed: "+err.Error())
continue
}
go func() {
err := this.listenRPC(listener, nil)
if err != nil {
remotelogs.Error("API_NODE", "listening '"+addr+"' rpc: "+err.Error())
return
}
}()
isListening = 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: f905bb7066d690511a4916b85253451181c6c85c

Contributor guide

No contributing guide indexed for this repository

Research direction

Inspect internal/nodes/api_node.go around lines 87-101, starting with the range over listen.Addresses() and its goroutine. Determine whether the captured addr can produce incorrect RPC error logging, then classify the finding as Bug, Mitigated, or Desirable Behavior by leaving the corresponding reaction.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
networking
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.