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

tsuru/tsuru: app/version/service.go; 10 LoC

Open
#13,988 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 [tsuru/tsuru](https://www.github.com/tsuru/tsuru) at [app/version/service.go](https://github.com/tsuru/tsuru/blob/5ba8204144228a5d34a45fc75f7736294d27cdf8/app/version/service.go#L71-L80)

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 75

[Click here to see the code in its original context.](https://github.com/tsuru/tsuru/blob/5ba8204144228a5d34a45fc75f7736294d27cdf8/app/version/service.go#L71-L80)

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

```go
for _, v := range versions.Versions {
vi := &appVersionImpl{
app: app,
storage: s.storage,
versionInfo: &v,
}
if vi.BaseImageName() == imageID {
return vi, nil
}
}

```

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: 5ba8204144228a5d34a45fc75f7736294d27cdf8

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with app/version/service.go lines 71-80 at commit 5ba8204144228a5d34a45fc75f7736294d27cdf8 and read the surrounding version lookup logic. Check the analyzer's reported reference to v in the composite literal, then determine whether the behavior is a bug, mitigated, or desirable and classify the finding accordingly.

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
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.