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

tsuru/tsuru: app/app.go; 17 LoC

Open
#18,236 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 [tsuru/tsuru](https://www.github.com/tsuru/tsuru) at [app/app.go](https://github.com/tsuru/tsuru/blob/7be708014704103204eb06d8f564c31d6926fc51/app/app.go#L601-L617)

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

[Click here to see the code in its original context.](https://github.com/tsuru/tsuru/blob/7be708014704103204eb06d8f564c31d6926fc51/app/app.go#L601-L617)

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

```go
for _, v := range volumes {
var binds []volumeTypes.VolumeBind
binds, err = servicemanager.Volume.Binds(app.ctx, &v)
if err != nil {
return errors.Wrap(err, "Unable to list volume binds for unbind")
}
for _, b := range binds {
err = servicemanager.Volume.UnbindApp(app.ctx, &volumeTypes.BindOpts{
Volume: &v,
AppName: app.Name,
MountPoint: b.ID.MountPoint,
})
if err != nil {
return errors.Wrapf(err, "Unable to unbind volume %q in %q", app.Name, b.ID.MountPoint)
}
}
}

```

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with app/app.go lines 601-617 and read the analyzer message about the reference to v in the composite literal. Inspect the surrounding range-loop code and determine whether the finding is a Bug, Mitigated, or Desirable Behavior; leave the corresponding reaction when the classification is clear.

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
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.