github-vet / github-vet/rangeloop-pointer-findings
jackdoe/cacher: main.go; 14 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [jackdoe/cacher](https://www.github.com/jackdoe/cacher) at [main.go](https://github.com/jackdoe/cacher/blob/fe688ac67863073817dc433c226745909e5c7456/main.go#L182-L195)
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 185
[Click here to see the code in its original context.](https://github.com/jackdoe/cacher/blob/fe688ac67863073817dc433c226745909e5c7456/main.go#L182-L195)
Click here to show the 14 line(s) of Go which triggered the analyzer.
```go
for _, addr := range strings.Split(S_LISTEN, ",") {
_D("listening @ %s\n", addr)
go func() {
if err := dns.ListenAndServe(addr, "udp", proxyer); err != nil {
log.Fatal(err)
}
}()
go func() {
if err := dns.ListenAndServe(addr, "tcp", proxyer); err != nil {
log.Fatal(err)
}
}()
}
```
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: fe688ac67863073817dc433c226745909e5c7456
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with main.go lines 182-195 and inspect how the range-loop variable addr is used by the two goroutines calling dns.ListenAndServe. Compare that behavior with the analyzer message, then classify the finding as Bug, Mitigated, or Desirable Behavior; done means the issue has a justified classification.
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
- Mostly clear
- Newbie friendliness
- 35/100