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

goki/pi: spell/model.go; 11 LoC

Open
#17,960 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 [goki/pi](https://www.github.com/goki/pi) at [spell/model.go](https://github.com/goki/pi/blob/ca330b91d1a1db95c3679c3ba625e17c3f59252f/spell/model.go#L615-L625)

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 edit was used in a composite literal at line 619

[Click here to see the code in its original context.](https://github.com/goki/pi/blob/ca330b91d1a1db95c3679c3ba625e17c3f59252f/spell/model.go#L615-L625)

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

```go
for _, edit := range edits {
score := md.corpusCount(edit)
if score > 0 && len(edit) > 2 {
if _, ok := suggestions[edit]; !ok {
suggestions[edit] = &Potential{Term: edit, Score: score, Leven: Levenshtein(&input, &edit), Method: MethodInputDeleteMapsToDict}
}
if score > max {
max = score
}
}
}

```

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: ca330b91d1a1db95c3679c3ba625e17c3f59252f

Contributor guide

No contributing guide indexed for this repository

Research direction

Read spell/model.go around lines 615-625 and inspect how the range variable edit is referenced in the Potential composite literal. Check the analyzer's reported condition against the surrounding spell-model behavior; done means determining whether this is a bug, mitigated, or desirable behavior and leaving the corresponding reaction.

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.