github-vet / github-vet/rangeloop-pointer-findings
beyang/sourcegraph-OLD-2: cmd/query-runner/all_saved_queries.go; 20 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [beyang/sourcegraph-OLD-2](https://www.github.com/beyang/sourcegraph-OLD-2) at [cmd/query-runner/all_saved_queries.go](https://github.com/beyang/sourcegraph-OLD-2/blob/b2cc9b2991b957021aef1a13c86ceb580803a01b/cmd/query-runner/all_saved_queries.go#L90-L109)
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 query used in defer or goroutine at line 103
[Click here to see the code in its original context.](https://github.com/beyang/sourcegraph-OLD-2/blob/b2cc9b2991b957021aef1a13c86ceb580803a01b/cmd/query-runner/all_saved_queries.go#L90-L109)
Click here to show the 20 line(s) of Go which triggered the analyzer.
```go
for _, query := range args.SubjectAndConfig.Config.SavedQueries {
spec := api.SavedQueryIDSpec{Subject: args.SubjectAndConfig.Subject, Key: query.Key}
key := savedQueryIDSpecKey(spec)
newValue := api.SavedQuerySpecAndConfig{
Spec: spec,
Config: query,
}
oldValue := allSavedQueries.allSavedQueries[key]
if !args.DisableSubscriptionNotifications {
// Notify users of saved query creation and updates.
go func() {
if err := notifySavedQueryWasCreatedOrUpdated(oldValue, newValue); err != nil {
log15.Error("Failed to handle created/updated saved search.", "query", query, "error", err)
}
}()
}
allSavedQueries.allSavedQueries[key] = newValue
}
```
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: b2cc9b2991b957021aef1a13c86ceb580803a01b
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.