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

SoMuchForSubtlety/chat-logger: main.go; 4 LoC

Open
#11,174 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 [SoMuchForSubtlety/chat-logger](https://www.github.com/SoMuchForSubtlety/chat-logger) at [main.go](https://github.com/SoMuchForSubtlety/chat-logger/blob/4c4b19390325fca66c56236042863162940c70c4/main.go#L123-L126)

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 at line 124 may store a reference to host

[Click here to see the code in its original context.](https://github.com/SoMuchForSubtlety/chat-logger/blob/4c4b19390325fca66c56236042863162940c70c4/main.go#L123-L126)

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

```go
for _, host := range con.Hosts {
go monitor(&host, stateChan)
go monitorMpm(15, &meme, dataChan)
}

```

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 which writes a pointer argument:
digraph G {
"(monitor, 2)" -> {}
}

No path was found through the callgraph that could lead to a function which passes a pointer to third-party code.

```

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: 4c4b19390325fca66c56236042863162940c70c4

Contributor guide

No contributing guide indexed for this repository

Research direction

Read main.go at lines 123-126 and inspect the surrounding loop and the monitor function. Determine whether the reported reference to the range variable can affect behavior, then classify the finding as Bug, Mitigated, or Desirable Behavior as requested; no test or other entry point is mentioned.

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
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.