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

donovanhide/superfastmatch: queue/command.go; 10 LoC

Open
#10,572 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 [donovanhide/superfastmatch](https://www.github.com/donovanhide/superfastmatch) at [queue/command.go](https://github.com/donovanhide/superfastmatch/blob/b2f51a4198a53183d5f16b29956f373b03001292/queue/command.go#L115-L124)

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

[Click here to see the code in its original context.](https://github.com/donovanhide/superfastmatch/blob/b2f51a4198a53183d5f16b29956f373b03001292/queue/command.go#L115-L124)

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

```go
for _, s := range source {
doc := &document.DocumentArg{Id: &s, TargetRange: item.TargetRange}
result, err := client.Search(doc)
if err != nil {
c <- runFailure(item, "Search", err)
}
if _, err := result.GetResult(registry, doc, true); err != nil {
c <- runFailure(item, "Get Result", 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: b2f51a4198a53183d5f16b29956f373b03001292

Contributor guide

No contributing guide indexed for this repository

Research direction

Read queue/command.go at lines 115-124 and inspect the analyzer's report about the reference to s in the composite literal. Determine whether this is a bug, mitigated behavior, or desirable behavior, then classify the finding with 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.