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

Xiol/tvhtc2: internal/pkg/state/state.go; 7 LoC

Open
#15,960 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 [Xiol/tvhtc2](https://www.github.com/Xiol/tvhtc2) at [internal/pkg/state/state.go](https://github.com/Xiol/tvhtc2/blob/506e44131e83b18925a5ffda53d0aa5e883c4047/internal/pkg/state/state.go#L71-L77)

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

[Click here to see the code in its original context.](https://github.com/Xiol/tvhtc2/blob/506e44131e83b18925a5ffda53d0aa5e883c4047/internal/pkg/state/state.go#L71-L77)

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

```go
for id, details := range s.Pending {
log.WithFields(log.Fields{
"id": id,
"title": details.Title,
}).Info("state: adding pending job")
s.JobCh <- &Job{id, &details}
}

```

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: 506e44131e83b18925a5ffda53d0aa5e883c4047

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with internal/pkg/state/state.go at lines 71-77 and inspect how Pending, Job, and JobCh are defined and used. Determine whether the referenced range variable can produce incorrect job details, then classify the analyzer finding as Bug, Mitigated, or Desirable Behavior; completion is a justified reaction on the issue.

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.