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

shurcooL/issuesapp: app.go; 8 LoC

Open
#13,238 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 [shurcooL/issuesapp](https://www.github.com/shurcooL/issuesapp) at [app.go](https://github.com/shurcooL/issuesapp/blob/926c51c28eca69d7a945f378982997804d2d534a/app.go#L79-L86)

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

[Click here to see the code in its original context.](https://github.com/shurcooL/issuesapp/blob/926c51c28eca69d7a945f378982997804d2d534a/app.go#L79-L86)

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

```go
for _, state := range []issues.State{issues.ClosedState, issues.OpenState} {
_, _, err = service.Edit(context.Background(), repo, 1, issues.IssueRequest{
State: &state,
})
if err != nil {
return 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: 926c51c28eca69d7a945f378982997804d2d534a

Contributor guide

No contributing guide indexed for this repository

Research direction

Review app.go lines 79-86, starting with the range loop and the issues.IssueRequest passed to service.Edit. Determine whether referencing state in the request produces incorrect behavior, then confirm whether the analyzer finding is a real bug or desirable behavior; done means the finding has a documented classification and resolution.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.