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

maksverver/go-ayu: client/client.go; 13 LoC

Open
#16,945 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 [maksverver/go-ayu](https://www.github.com/maksverver/go-ayu) at [client/client.go](https://github.com/maksverver/go-ayu/blob/d34ba60ce3682a5667e71b375d97919bfb805fcc/client/client.go#L114-L126)

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 value is reassigned at line 117

[Click here to see the code in its original context.](https://github.com/maksverver/go-ayu/blob/d34ba60ce3682a5667e71b375d97919bfb805fcc/client/client.go#L114-L126)

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

```go
for _, value := range values {
switch key {
case "game":
game_id = &value
num_games++
case "white":
white_key = &value
num_keys++
case "black":
black_key = &value
num_keys++
}
}

```

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Read client/client.go lines 114-126 and the linked range-loop finding description. Inspect whether taking addresses of the range variable makes game_id, white_key, or black_key point to the intended values, then use the issue reactions to record Bug, Mitigated, or Desirable Behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
tooling
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.