github-vet / github-vet/rangeloop-pointer-findings
jonnyguio/tcc: chapter-4/chat/server-based/server/server.go; 8 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [jonnyguio/tcc](https://www.github.com/jonnyguio/tcc) at [chapter-4/chat/server-based/server/server.go](https://github.com/jonnyguio/tcc/blob/d45670dd650c39e6f147ed2db134c20b8ad26ee8/chapter-4/chat/server-based/server/server.go#L70-L77)
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 name used in defer or goroutine at line 74
[Click here to see the code in its original context.](https://github.com/jonnyguio/tcc/blob/d45670dd650c39e6f147ed2db134c20b8ad26ee8/chapter-4/chat/server-based/server/server.go#L70-L77)
Click here to show the 8 line(s) of Go which triggered the analyzer.
```go
for name, conn := range clients {
go func(conn net.Conn) {
_, err := conn.Write([]byte(message))
if err != nil {
dead <- name
}
}(conn)
}
```
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: d45670dd650c39e6f147ed2db134c20b8ad26ee8
Contributor guide
No contributing guide indexed for this repository
Research direction
Read chapter-4/chat/server-based/server/server.go around lines 70-77, focusing on the range loop and goroutine that writes to each connection. Compare the analyzer warning with the surrounding chat-server behavior and determine whether the captured loop variable can cause incorrect client handling. Done means classifying the finding as Bug, Mitigated, or Desirable Behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100