github-vet / github-vet/rangeloop-pointer-findings
smartrecruiters/rabbitr: cmd/commons/operation_executor.go; 23 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [smartrecruiters/rabbitr](https://www.github.com/smartrecruiters/rabbitr) at [cmd/commons/operation_executor.go](https://github.com/smartrecruiters/rabbitr/blob/4cfdea619103e14dddcc0da210e92167c2d0b715/cmd/commons/operation_executor.go#L59-L81)
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.
>
[Click here to see the code in its original context.](https://github.com/smartrecruiters/rabbitr/blob/4cfdea619103e14dddcc0da210e92167c2d0b715/cmd/commons/operation_executor.go#L59-L81)
Click here to show the 23 line(s) of Go which triggered the analyzer.
```go
for _, subject := range *subjects {
start := time.Now()
parameters := make(map[string]interface{}, 1)
parameters[subjectOperator.Type] = subject
subjectMatches, err := matchExpression.Evaluate(parameters)
AbortIfError(err, fmt.Sprintf("Error evaluating following filter expression[%s] err: %s", filter, err))
if subjectMatches.(bool) {
if dryRun {
Fprintf(w, "Skipping %s operation: %s in dry-run mode\n", subjectOperator.Type, subjectOperator.GetName(&subject))
bar.Increment()
bar.DecoratorEwmaUpdate(time.Since(start))
continue
}
matchingSubjectsCount++
subjectOperator.ExecuteAction(client, &subject, w)
Fprintln(w)
}
bar.Increment()
// since ewma decorator is used, we need to pass time.Since(start)
bar.DecoratorEwmaUpdate(time.Since(start))
}
```
Click here to show extra information the analyzer produced.
```
No path was found through the callgraph that could lead to a function which writes a pointer argument.
No path was found through the callgraph that could lead to a function which passes a pointer to third-party code.
root signature {GetName 1} was not found in the callgraph; reference was passed directly to third-party code
```
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: 4cfdea619103e14dddcc0da210e92167c2d0b715
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with cmd/commons/operation_executor.go around lines 59-81 and inspect how the range variable subject is passed to GetName and ExecuteAction. Use the analyzer context and the linked classification descriptions to decide whether this 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
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100