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

chances/party-server: models/playlist.go; 15 LoC

Open
#16,068 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 [chances/party-server](https://www.github.com/chances/party-server) at [models/playlist.go](https://github.com/chances/party-server/blob/93edf929d741f2e7c40a7f9f56bd8478eb01aac9/models/playlist.go#L123-L137)

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

[Click here to see the code in its original context.](https://github.com/chances/party-server/blob/93edf929d741f2e7c40a7f9f56bd8478eb01aac9/models/playlist.go#L123-L137)

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

```go
for _, track := range tracks {
artist := track.FirstArtist()
_, exists := artists[artist]
if exists {
artists[artist] = append(artists[artist], &track)
length := len(artists[artist])
if length > longestLength {
longestLength = length
}
}
artists[artist] = []*Track{&track}
if longestLength == 0 {
longestLength++
}
}

```

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: 93edf929d741f2e7c40a7f9f56bd8478eb01aac9

Contributor guide

No contributing guide indexed for this repository

Research direction

Open models/playlist.go at lines 123-137 and compare the reported range-loop pointer use with the surrounding context. Decide whether the analyzer finding is a bug, mitigated, or desirable behavior, then record the corresponding reaction; completion is the classification reaction.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.