github-vet / github-vet/rangeloop-pointer-findings
ScriptRock/dialog: dialog.go; 11 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [ScriptRock/dialog](https://www.github.com/ScriptRock/dialog) at [dialog.go](https://github.com/ScriptRock/dialog/blob/9c8b201e9c6850e44fb0c7c0a75b90ad0e37775f/dialog.go#L210-L220)
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.
> reference to mo was used in a composite literal at line 218
[Click here to see the code in its original context.](https://github.com/ScriptRock/dialog/blob/9c8b201e9c6850e44fb0c7c0a75b90ad0e37775f/dialog.go#L210-L220)
Click here to show the 11 line(s) of Go which triggered the analyzer.
```go
for _, mo := range opts {
if mo.Key == k {
crumbFunc := mo.CrumbText
if crumbFunc == nil {
crumbFunc = func() string {
return mo.Text
}
}
return ChildDialog{mo.Next, crumbFunc, m, &mo}, nil
}
}
```
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: 9c8b201e9c6850e44fb0c7c0a75b90ad0e37775f
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with dialog.go lines 210-220 at commit 9c8b201e9c6850e44fb0c7c0a75b90ad0e37775f and inspect the analyzer's reference-to-mo warning in context. Determine whether the range-loop reference is a bug, mitigated, or desirable behavior, then leave the corresponding reaction on the issue.
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
- 35/100